I've limited the input field to only numbers through js but am not sure how to also allow decimals...
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
Thank you in advance!
Answer:
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
return false;
return true;
}
Adding the charCode 46 worked perfectly (keypress value). 190 and 110 did nothing.
Thanks for your help all!
See Question&Answers more detail:os