Validating a data input javascript -


i have been looking validate data input check whether integer or string. looked around , saw suggestions , typeof suggestions nothing seems work.

var nam = prompt("enter name:")      person.push(nam);  var mk1 = prompt("enter mark 1:");     var mk1 = parseint(mk1);     mark1.push(mk1); 

if want check whether input string not number try this:

if (isnan(parseint(name, 10)) {     //name string } else {     //name number } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -