I want to manually invoke enter key press event on textbox through JS or jQuery.
I dont want to capture that event. I just want to invoke enter key press event.
You can trigger it like:
// dummy event listener
$("input").keydown(function() { return true; });
var keyEvent = jQuery.Event("keydown");
keyEvent.keyCode = 13;
$("input").trigger(keyEvent);
See this post too: Definitive way to trigger keypress events with jQuery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With