Плагин валидации jQuery
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js"></script>
Healthy Hawk
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
then add javascript code:
$(document).ready(function() {
$("#form").validate();
});
</script>
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,
},
}
});
});
function submitFunction(event){
event.preventDefault();
}
$("#form_id").submit(submitFunction);
form validation