Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Only allow numbers and decimal point to be entered into input boxes. 46 = '.' & 48-57 = '0-9'
//Only allow numbers and decimal point to be entered into input boxes. 46 = '.' & 48-57 = '0-9'
function numOnly(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if ((charCode == 46) || (charCode >= 48 && charCode <= 57)){
return true;
}
else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.