I have got an Input field which I want to execute. Normally I would do it by document.getElementById("myinput").click()
, but it is an Input so I have to execute it by simulating enter.
I want something like document.getElementById("myinput").performEnter();
I found this from How to trigger the enter keypress:
var e = $.Event( "keypress", { which: 13 } );
$('#yourInput').trigger(e);
but is there a way to do this only in JavaScript?