{"id":778,"date":"2010-05-27T13:04:58","date_gmt":"2010-05-27T07:34:58","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=778"},"modified":"2015-05-19T17:47:42","modified_gmt":"2015-05-19T12:17:42","slug":"client-side-validation-for-number-values","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/client-side-validation-for-number-values\/","title":{"rendered":"Client side validation for Number values"},"content":{"rendered":"<p>Hi,<br \/>\nRecently in my project , i needed to validate an input (whether it is a integer or not) on client side.<br \/>\nI tried many codes but they are bit lengthy. Then I encountered the simplest way as given below, which worked.<br \/>\nFor any input value, it checks whether it is an Integer or not.<\/p>\n<blockquote>\n<pre lang=\"groovy\">     function isInteger(a) {\r\n      return (!(parseInt(a).toString() == 'NaN'))\r\n        }\r\n<\/pre>\n<\/blockquote>\n<p>It worked for me ans saves a lot of time.<br \/>\nHope it helps.<\/p>\n<p>Regards<br \/>\nVishal Sahu<br \/>\nvishal@intelligrape.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, Recently in my project , i needed to validate an input (whether it is a integer or not) on client side. I tried many codes but they are bit lengthy. Then I encountered the simplest way as given below, which worked. For any input value, it checks whether it is an Integer or not. [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[7],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/778"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=778"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/778\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}