Answers for "make enter on input click a button"

8

press button on enter

searchInput.onkeyup = function (e) {
    if (e.key === 'Enter') {
        searchBtn.click();
    }
}
Posted by: Guest on March-11-2021
1

How to trigger button using enter keyword in an input box?

document.getElementById("pw")
    .addEventListener("keyup", function(event) {
    event.preventDefault();
    if (event.keyCode === 13) {
        document.getElementById("myButton").click();
    }
});

function buttonCode()
{
  alert("Button code executed.");
}
Posted by: Guest on February-05-2022

Code answers related to "make enter on input click a button"

Code answers related to "Assembly"

Browse Popular Code Answers by Language