0

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, range:[1,100]},
        }

EDIT: I realize I actually need max value, not max length, So what is the jQuery for max value?

2
  • this code: a) uses jQuery, b) uses some kind of plugin for validation. Tag this properly please Commented Jul 17, 2011 at 1:55
  • nevermind...found the code i needed elsewhere. For anyone reading this, its just {required:true, max:12} Commented Jul 17, 2011 at 2:04

1 Answer 1

2

To make an element require a given maximum, use max:

$("#myform").validate({
  rules: {
    field: {
      required: true,
      max: 23
    }
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.