Capture enter on input (Pure JavaScript)
Capture the enter key on input using pure JavaScript
HTML
<input id="input" type="text" placeholder="Enter captured here">
<input id="input2" type="text" placeholder="Enter not captured here">
JavaScript
var myInput = document.getElementById("input");
$(document).keyup(function(event) {
if ($("#input").is(":focus") && event.key == "Enter") {
alert('Branko');
}
});