form validation in javascript and jquery code example
Example 1: form validation using jquery
jQuery(document).ready(function() {
jQuery("#forms).validate({
rules: {
firstname: 'required',
lastname: 'required',
u_email: {
required: true,
email: true,//add an email rule that will ensure the value entered is valid email id.
maxlength: 255,
},
}
});
});
Example 2: jquery form validation
function submitFunction(event){
event.preventDefault();
}
$("#form_id").submit(submitFunction);