I have the below HTML code that will accept only numbers and NOT alphabets. I want it to accept period too. What's wrong with this? I don't want to use a different jQuery or javascript function to call on key press. I want to go with the same way I used but should allow period too. How? Thanks.
<input onkeypress="return /\d/.test(String.fromCharCode(((event||window.event).which|| (event||window.event).which)));"
ondrop="return false" onpaste="return false" maxlength="8" type="text" />
Aucun commentaire:
Enregistrer un commentaire