I want to restrict the Chinese character in the input field, only show the number in the input field. But below coding cannot let me restrict the Chinese character. Hope someone can help me on how to solve the problem?
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
console.log(charCode);
if (charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
return true;
}
<input type="text" onkeypress="return isNumberKey(event);" id="code" name="code" value="" title="code">