I am trying to make a button key "trigger" on a specific page using tampermonkey. Instead of using mouse click every time to click Button called "continue".
So when I click keyboard button "ENTER" this hover button should be automatically clicked, theres any ready to use code while I can just put this HTML code.
Thanks.
START MEMBERSHIP
解决方案
USING JQUERY
You can use easy jQuery to achieve it.
Just add a cdn given below in your main HTML page
And just open a script tags and copy paste this code.
$(document).keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
$("#simplicityPayment-START").click();
}});
USING PURE JAVASCRIPT (NO EXTERNAL LIBRARY)
EDIT 1: As don't own the website & using tampermonkey. Okay so there is another way to achieve this, that is Pure JAVASCRIPT. it requires no CDN.
just Add this JAVASCRIPT.
window.addEventListener('keyup', function (e) {
if (e.keyCode === 13) {
var button = document.getElementById("simplicityPayment-START");
button.click();
}
}, false);