user2144097 user2144097 - 2 years ago 127
Javascript Question

How to add "enter to search" option?

I would like to add that when I press "enter" in the search form, it will search, and not only when I click search button:

jQuery('#webq_search_submit').click(function() {

jQuery('#webq_txt_search').css("border", "none");

Answer Source

   if (e.keyCode === 13){
        console.log('enter detected');
   // jQuery('#webq_txt_search').css("border", "none");

Use if using this search inside form

$("form").submit(function() { return false; });

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download