JavaScript form validation maxVALUE
Where minvalue
is now I would actually like to have a maxvalue
of 12. What is the code for max value instead of min value? Thanks!
This uses jQuery and jquery.validate:
$(document).ready(function() {
$('#form').validate({
rules: {
username: {required:true, minlength:12},
items: {required:true, r开发者_JAVA技巧ange:[1,100]},
}
EDIT: I realize I actually need max value, not max length, So what is the jQuery for max value?
To make an element require a given maximum, use max
:
$("#myform").validate({
rules: {
field: {
required: true,
max: 23
}
}
});
精彩评论