I'm trying to remove non-numeric characters from a string while typing, but it's not working in Chrome/Safari - anyone know a workaround?
The problem with Chrome is that if for example you enter 4 numbers, then a letter, it clears the text box and starts again, whereas other browsers just remove the letter.
Here is the code I have:
$('input[type=number]').bind('keyup', function (e) {
this.value = this.value.replace(/[^0-9]+/g, '');
});
Many thanks