开发者

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
    }
  }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜