Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have text box which will not allow a number starting with "0" in first and second positions number length is 3.


for example
if 01 entered it should give alert.
if 001 entered also it should give alert.

Thanks in advance.
Posted

Hi
You can do by this,

JavaScript
function IsNumeric(data)
{
if (data === parseInt(data))
            alert("data is integer")
        else
            alert("data is not an integer")
}
 
Share this answer
 
v2
Comments
Member 10667008 17-Mar-14 2:44am    
Thanks for your reply.
Krunal Rohit 17-Mar-14 2:45am    
What is it, anyway ??

-KR
Looks like Homework. So I'm gonna give you one in return ;)

Read this first : Learn Regular Expressions (RegEx) with Ease[^]

-KR
 
Share this answer
 
Comments
Member 10667008 17-Mar-14 2:44am    
Thank you very much.
I think this link will help JavaScript beginners like me.
NvsYazilim 17-Mar-14 12:22pm    
Nice one :)
Krunal Rohit 17-Mar-14 13:24pm    
Thanks :)

-KR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900