Answers for "search by pressing enter in js"

2

javascript detect enter press on input

var el = document.getElementById("myInputID");
el.addEventListener("keydown", function(event) {
    if (event.key === "Enter") {
        // Enter key was hit
    }
});
Posted by: Guest on January-06-2020
0

search box enter key javascript

document.getElementById("id_of_textbox")
    .addEventListener("keyup", function(event) {
    event.preventDefault();
    if (event.keyCode === 13) {
        document.getElementById("id_of_button").click();
    }
});
Posted by: Guest on August-05-2021

Code answers related to "search by pressing enter in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language