robert_gsfame Posted April 26, 2010 Share Posted April 26, 2010 I wish to validate textbox so that anything besides numeric is not allowed I try to use isNan but not working (don't know why) then i try to use match() here is the code var test = /[0-9]+$/; if(!(mystring.match(test)) alert("wrong");} when i type "1234abc" alert appear but when i type "abc1234" alert not appear which part should be modified? thx in advance Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted April 26, 2010 Author Share Posted April 26, 2010 oops i miss the first part /\b[0-9]+$/; Quote Link to comment Share on other sites More sharing options...
salathe Posted April 26, 2010 Share Posted April 26, 2010 You're probably really wanting to use an anchor to make sure that all characters in the string are digits rather than just those at the end. Another alternative would be to test if any one character is not a digit. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.