Created
August 7, 2020 15:46
-
-
Save ankitkanojia/72f799f8e837d3039fb0c3054097e70e to your computer and use it in GitHub Desktop.
To configure jquery validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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