Answers for "how to make input submit on enter"

1

html form not submit on enter

$(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
Posted by: Guest on June-12-2020
0

press button on enter

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

Code answers related to "how to make input submit on enter"

Browse Popular Code Answers by Language