jQuery issue with chaining isNumeric -
i've got simple conditional checks if id equal , checks if number. i'm using isnumeric combination of .length. reason isnumeric part not working can enter string of letters , doesn't validate. ideas?
var $this = $(this); if(this.id == "username" && $.isnumeric($this.val()).length < 10 ){ //do }
the reason you're having problems this:
$.isnumeric( $this.val() )
returns true
or false
, , checking length of boolean makes no sense, true
or false
never have length on 10, booleans does'nt have length, , returns "undefined" ?
maybe meant :
if ( this.id == "username" && $.isnumeric( $this.val() ) && $this.val().length < 10 ){ // if value numeric, , string length under 10 }
Comments
Post a Comment