I'm using this logic: Jquery: how to trigger click event on pressing enter key to press Submit button on Enter key press.
But on a web page Enter key seems to be disabled as Enter key press isn't invoking the callback attacthed to keypress
function:
var otp_fun = function (otp_sel, cmd_btn_sel) {
$(otp_sel).css({
'font-size': '2em',
'color': 'red',
'height': '3em',
'width': '12em'
}).attr('type', 'text').focus().keypress(function (e) {
if (e.which == 13) {
e.preventDefault();
console.log("otp_sel len=",$(otp_sel).val().length);
if ($(otp_sel).val().length >= 4)
{
console.log("pressing eeee button");
$(cmd_btn_sel).trigger('click');
}
return false;
}
else
{
console.log("e.which=",e.which);
}
});
}
How to re-enable this Enter key?