Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8548147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:25:38+00:00 2026-06-11T13:25:38+00:00

According to the documentation – such as it is – you can specify validation

  • 0

According to the documentation – such as it is – you can specify validation that requires a parameter of an input element by using an attribute. It says this is the recommended method. Like this:

<input type="password" minlength="6" maxlength="50"/>

Okay, that’s easy. Now how do you specify (for example) a range using an html attribute?

<input type="number" range="[5, 50]"/>

No, that doesn’t work. Neither does no brackets, curly braces, curly braces and brackets or any combination thereof. But this works in a completely unexpected way:

<input type="number" range="53"/> 

– it spits out the error message “number must be between 5 and 3”

Can someone please show me the proper syntax for this?

NOTE: This is an exemplar. I realize I could solve this particular problem by using

<input type="number" min="5" max="50"/> 

I’m looking for a more general answer regarding how to construct a complex validation rule using the jquery-validate attributes API.

Thanks!

EDIT

Here’s another example. How do you do this using the “preferred” attribute syntax?

$('form').validate({
    rules: {
        rt: {
          required: function(element) {
            return $("#age").val() < 13;
          }  
        }
    }
});

The following does not work:

<form>
    <input type="text" id="age" name="age"/>
    <input type="text" id="rt" name="rt" required="function(element) { return $('#age').val() < 13;}"/>

    <input type="text" id="tabcatcher"/>
    <input type="submit"/>
</form>

Play with the following jsfiddle:

http://jsfiddle.net/GKNZF/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:25:40+00:00Added an answer on June 11, 2026 at 1:25 pm

    That’s a known issue/bug in the plugin, as reported here. Basically, the plugin is considering 53 as an array of two digits, with 5 as the mininum value, and 3 as the maximum.

    To fix it, you need to apply the following patch:

    // Patch by Chris Tierney (CF Webtools 7/13/2011)
    // Issue logged at https://github.com/jzaefferer/jquery-validation/issues/112
    $.each(['rangelength', 'range'], function() {
        if (typeof rules[this] == 'string') {
            rules[this] = rules[this].split(",");
        }
        if (rules[this]) {
            rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Hibernate documentation : After observing that arrays cannot be lazy , you
According to Android documentation, using the .getTime() method in the Android location will return
I'm using the Dojo datagrid client side, it works well and according to documentation
According documentation: System.Array.Sort<T> - sorts the elements in an entire System.Array using the System.IComparable
I was looking into HTML:Element documentation and came across attr_get_i method which according to
I'm currently using Fog to manage Dyn DNS provider. According the documentation, there's a
according documentation: On success, the function returns the converted integral number as a long
According to Apple documentation and other documentation I have read about on disk encryption
According to the documentation for -[UIView setNeedsLayout] : Because this method does not force
According to the documentation of java.util.Pattern , the POSIX character class \p{Graph} ( [:graph:]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.