Jquery validation - allow number without the leading zero?

前端 未结 2 610
无人及你
无人及你 2020-12-10 04:22

I\'m using jquery validation (http://docs.jquery.com/Plugins/Validation) like so:

    var $__field = $(\"#selector\");  
    if ($__field.is(\":visible\")) {         


        
2条回答
  •  不思量自难忘°
    2020-12-10 04:31

    The solution included in jQuery Validation 1.14.0 takes care of the leading zero issue but leaves a leading negative sign issue. -.124 is invalid. -0.124 is valid. The RegEx provided in the posting above seems to allow -.124 so I favor it over the solution in jQuery Validation 1.14.0

提交回复
热议问题