I need to call 2 functions onkeypress out of which first function is return type; and second function is not getting called but if use in reverse order it is working
Requirement:
OnKeyPress, the key should be validated. if number, accept the value in TextBox then copy the value into another textbox; If not a number, then do nothing
Correct Order but 2nd function is not getting called;
<input type="text" name="no_of_units" id="no_of_units" size="5"
onkeypress="return isNumberKey(event);calc_exchange();">
In Reverse order both functions are working. I need the isNumberKey function to be called first.
<input type="text" name="no_of_units" id="no_of_units" size="5"
onkeypress="calc_exchange();return isNumberKey(event);"
Functions :
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
function calc_exchange()
{
var raw1=document.getElementById("no_of_units").value;
document.getElementById("next_no_of_units").value=raw1;
}
I need the following order of function to be called;
- return isNumberKey(event)
- calc_exchange()