Kindle Silk browser having issues with keypress event?

161 views Asked by At

I'm trying to restrict a text box to numeric entry only in a project using knockout.js and MVC.

I'm doing a data-bind on the keypress event to call a function from the VM that looks like this:

this.NumbersOnly = function (data,evt) {        
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode != 46 && (charCode < 48 || charCode > 57)))
        return false;
    return true;
}

This will allow only numbers and decimals in to the input text box. This works great in every browser I've tested except that I'm having issues in Kindle's Silk browser, as I can still type alpha characters in. If anyone has any ideas to get Silk to agree, please let me know!

0

There are 0 answers