Is there a bug with min="0" in jquery validation? Or am I overlooking something? -


jquery validation seems work fine min="1" , min="-1", not min="0". consider jsfiddle. appropriately objects value of -5 in first input element , in third, accepts -5 in second one, min="0".

-1 , 1 fine. 0 not

is bug in jquery validation or overlooking something?

<form id="myform">   <input type="text" name="negativeone" min="-1"/>   <br/>   <input type="text" name="zero" min="0"/>       <br/> <input type="text" name="one" min="1" /> </form>  <button id="event2">test</button> <a href="http://docs.jquery.com/plugins/validation" target="_blank">validation documentation</a> 

javascript

$(document).ready(function () {     $('#myform').validate({     });      $('#event2').on('click', function () {         $('#myform').valid();     }); }); 

to answer question:

"no", you're not overlooking anything, , "yes", appears bug.

look @ these 2 identical jsfiddles, version different...

jquery validate v1.10 (no bug): http://jsfiddle.net/mblase75/mgvrn/

jquery validate v1.11.1 (bug): http://jsfiddle.net/mgvrn/1/

also, appears issue when using html5 validation attributes.

until plugin fixed, workaround declare rule inside .validate().

$('#myform').validate({     rules: {         zero: {             min: 0         }     } }); 

working demo (v1.11.1): http://jsfiddle.net/mgvrn/2/


i suggest report bug on developer's github page:

https://github.com/jzaefferer/jquery-validation/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -