Here is the jQuery code
$("#register-form").submit(function (e) {
e.preventDefault();
}).validate({
rules: {
name: "required",
address: "required",
phone: "required",
landmark: "required",
pincode: "required",
city: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please enter your name",
address: "Please enter your address",
phone: "Please enter your phone",
landmark: "Please enter your landmark",
pincode: "Please enter your pincode",
city: "Please enter your city",
email: "Please enter a valid email address"
},
submitHandler: function (form) {
//form.submit();
//alert("Do some stuff...");
$("#step1").hide();
//$('#step1img').css('opacity','0.5');
//$('#step2img').css('opacity','1');
$("#step2").show();
//submit via ajax
return false;
}
});
// });
$("#back").click(function () {
$("#step1").show();
$("#step2").hide();
});
function submitform() {
document.getElementById('#register-form').submit();
}
this is my fiddle , http://jsfiddle.net/bd4T2/ i have tried multipage form , using jquery validation js , but form is not submitting
okay, I copied the code out of the fiddle (which wasn't working and did not include the jquery library) and i found the error in the submitform function, you've got a hash in front of the form id when using the dom to find the form:
function submitform() {
document.getElementById('#register-form').submit(); //<-- '#register-form'
}
//this is not going to work, you were looking to use jquery here
document.getElementById('#register-form').submit();
will not work, because there's no #
in the form id, so it should read like this;
function submitform() {
$('#register-form').submit();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.