简体   繁体   中英

only allow integer using validate.js

im using validate.js.

 var v = $("#form1").validate({
                    ignore: ':hidden',
                    rules: {
                        txtName: { required: true },
                        txtTitle: { required: true }
                        txtInterval:{///Only allow integer}

                    },
                    messages: {
                        txtName: "<br/>Please enter a Name",
                        txtTitle: "<br/>Please enter a Title",
                        txtInterval:"<br/>Please Enter a Integer"
                    }
                });

Code Works fine i want to validate txtInterval which allow only integer value but don't know how to do this through validate.js.Show me a correct way. Thanks.

$("#myform").validate({
  rules: {
    field: {
      required: true,
      number: true
    }
  }
});

Read Documentation

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM