I have a asp.net form where I am trying to use Jquery Validation plugin. I am trying to add the rules using javascript using the rules method. so i tried something like this
$(document).ready(function () {
$('form').validate();
$('td [type="text"]').each(function(ind,element) {
$(element).rules("add", {
number: true,
messages: {
number:"requere number"
}
});
});
}
Html have css display:none,part marking
<td style="vertical-align: middle">
<input name="1ModalC1.1" type="text" class="input-validation-error">
</td>
Class "input-validation-error"appear.But form submited
By default, jQuery Validation ignores hidden fields. Therefore you need to set the ignore
value :-
$('form').validate({ ignore: "" }); // default ":hidden"
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.