Good day. Is there a way to filter typed inputs right upon typing the characters using Javascript? i plan on using Javascript's "Onkeypress" command to accept only "numeric, i.e., 1,2,3...", ". (dot)", and ", (comma)" command. please help.thanks in advance.
Comments
:
=================================================
Here is your solution
=================================================
57 || event.keyCode==45 || event.keyCode==47) event.returnValue = false;">
We can validate textbox by onkeypress event of the control By checking whether the keycode of the key pressed as the user types falls within the range of the number keys 48-57(i.e 0-9 and '.') ,if not belong to that range it will return false then it will disable the keypress action
function NumericValidation(eventObj)
{
var keycode;
if(eventObj.keyCode) //For IE
keycode = eventObj.keyCode;
else if(eventObj.Which)
keycode = eventObj.Which; // For FireFox
else
keycode = eventObj.charCode; // Other Browser
[code]http://www.mindfiresolutions.com/Numeric-validation-using-Javascript-612.php[/code]