What is the Java script to check numeric values in a texbox while typing itself ?

Posted by Nav234 under JavaScript on 7/16/2010 | Views : 4189 | Status : [Member] | Replies : 2
Hi all

Im having a textbox control which should accept non - numerical values .
I would like write a java script for this Numerical checking while the user
types the character in my textbox itself.
how do i do that ?

thanks in advance

S.Naveen...


Responses

Posted by: Neeks on: 7/17/2010 [Member] Bronze

Up
0
Down
You will get the details related to JavaScript validations and jQuery validations from

JavaScript
http://www.mindfiresolutions.com/Numeric-validation-using-Javascript-612.php

jQuery
http://www.texotela.co.uk/code/jquery/numeric/
http://stackoverflow.com/questions/2812585/jquery-validate-characters-on-keypress

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: BangaruBabu on: 7/26/2010 [Member] Starter

Up
0
Down
var regExp2=/^[0-9]*$/;

if(document.getElementById("<%=txtEmpid.ClientID%>").value.search(regExp2)==-1)
{
alert('Employee ID Should Contain Characters and Numbers');
document.getElementById("<%=txtEmpid.ClientID %>").focus();
return false;
}


BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response