Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
To configure jquery validation
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.js"></script>
function InitializeValidation() {
$('.reuiredInput').attr("required", "required")
$("#verificationSelfFormControl").validate({
rules: {
".reuiredInput": {
required: true
}
},
errorElement: 'span',
errorPlacement: function (error, element) {
if (element.attr("type") == "radio") {
element.parent().parent().parent().append(error);
} else {
element.parent().append(error);
}
}
});
jQuery.extend(jQuery.validator.messages, {
required: "Please fill this field",
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment