javascript - Why is .2 not a valid number for jquery.validate.js? -


this using jquery's validate.

i have textbox if enter 0.2 validates, on .2 fails validation saying has number.

it fails on @html.validationsummary @ bottom of razor view.

problem .2 not number. anyway make number before hits validation?

jsfiddle demo

you implement small observer fix case number input starts . this:

$('body').on('blur','input[data-val-number]',function(){  if( this.value[0] == "." ){   this.value = "0" + this.value;   $(this).valid();  } }); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -