Where is my mistake?
I'd like to trigger OK button by pressing "Enter" (instead of clicking on it)
<div class="buttonbar">
<button name="Cancel" type="button" onclick="window.KeyboardMaestro.Cancel('Cancel')">Cancel</button>
<button name="OK" type="submit" id="submit" onclick="window.KeyboardMaestro.Submit('OK')">OK</button>
<script>
document.getElementById("submit")
.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById("submit").click();
}
});
function buttonCode()
{
alert("Button code executed.");
}
</script>
</div>