HTML <input type=“number”>, for mobile devices enter key not working

1.3k views Asked by At

I've got a single line of code (no forms involved) here:

<input name="txtQty" type="number" id="txtQty" class="form-control" autocomplete="off" pattern="\d*">

Tried the below code to get the keycode to know that enter key pressed:

$("#txtQty").on('keyup', function (e) {
    if (e.key === 'Enter' || e.keyCode === 13) {
        alert("enter");
    }
});

When clicking on the Next button it's a move to the next input element instead of fire keyup event:

enter image description here

Is there any way to press the next button on the keyboard and get that to execute my other javascript function?

0

There are 0 answers