houssam_ballout Posted February 11, 2010 Share Posted February 11, 2010 Hello I had a web form, there is a field that should contain only numbers, so how can I check if the field contains numbers?? (not decimals)Thanks Link to comment Share on other sites More sharing options...
jeffman Posted February 11, 2010 Share Posted February 11, 2010 function isInt (n) { return Number(n) % 1 == 0;} More explanation here: isInt. The link even shows you how to reprototype the String object if you expect to do this operation frequently. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.