Answers for "on escape keypress javascript"

5

javascript detect escape key

document.addEventListener('keydown', function(event){
	if(event.key === "Escape"){
		//do something
	}
});
Posted by: Guest on November-12-2019
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

Code answers related to "Javascript"

Browse Popular Code Answers by Language