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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -