javascript - How to validate Integer value in jquery -


I have to validate the input field, it should be an integer (0-100), if max_seat = 5 then min_seat is less Should be equal to or equal to maximum_set

   & Lt; / Form & gt;  

And jquery looks like this, how to make rules in this way, thank you

  $ ("# table_info"). {Rule: {min_range: "required integer", max_ seats: "required integer"}, message: {max_ seats: "* required", min_range: "* required",}});  

It is not how many rules you declare (this short story style is used Only can be done with a rule.)

  Rules: {min_range: "required integer", max_seats: "required integer"}  < / Pre> 

You have to declare each rule separately. And for an integer, you can use it.

Your HTML is also not valid for this plugin ...

  & lt; Input class = "span6" id = "max_seat" name = "default_seats" type = "text" / & gt; & Lt; Input class = "span6" id = "min_seats" name = "default_seats" type = "text" />  

Each field must have an unique name attribute, and you will declare the rule based on that rule that the Name . ( Message option declared as such)

  Rules: {min_seats: {// < - This field has the NAME feature, no id required: true, numeral: true}, max_seats: {// & lt; - This field has the NAME feature, no id required: correct, numeral: true}}  

To compare two fields, you can add your new custom The rule must be used and declared.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -