Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please tell me how can i validate my textbox to enter first numeric character as 9 and rest any numeric value in javascript.
Posted
Comments
Arunprasath Natarajan 26-Sep-12 6:26am    
Is it mobile no. validation

1 solution

assign x value with your number you want to validate.

C#
function test() {
       var x = '92385';
       if (isNumber(x))
           if (x.charAt(0) == '9') {
               alert("Success");
           }
   }
 function isNumber(n) {
        return !isNaN(parseFloat(n)) && isFinite(n);
    }
 
Share this answer
 
Comments
priti2010 26-Sep-12 6:55am    
thanx 4 the help!!!!

my textbox may have alphabet search also and if numeric search than the first numeric value should be 9...

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