Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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();
    }
});
Comment

js enter key event listener

document.getElementById("yourElementId").addEventListener("keypress", function (event) {
    if (event.key === "Enter") {
       // the code you want to run
    }
})
Comment

javascript on enter search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Comment

javascript on enter key searchbox

// Bind Enter key to search bar
$("#MySearchBar").keypress(function (e) {
  if (e.keyCode === 13) {
    MyVoidFunction();
  }
});
Comment

javascript on enter search

function search(query){
   query.preventDefault();
   let vquery = query.target.elements["search"].value;
   console.log(vquery)
   
}

something.addEventListener("submit", search, false)
Comment

javascript on enter search

function search(query){
   query.preventDefault();
   let vquery = query.target.elements["search"].value;
   console.log(vquery)
   
}

something.addEventListener("submit", search, false)
Comment

javascript on enter search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Comment

javascript on enter search

<div class="box">
  <div class="container-1">
    <form id="something">
      <input name="search" placeholder="Search... type ENTER to submit or use the button -->">
      <input type="submit"> 
    </form>
    <div class="icon"  ></div>
   </div>
</div>
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: open youtube video at specific time javascript 
Javascript :: add line number in javascript 
Javascript :: count in string javascript 
Javascript :: express return svg 
Javascript :: ip address validation regex angular 
Javascript :: convert html to pdf using javascript 
Javascript :: how to know the current route in react class component 
Javascript :: js for of 
Javascript :: react button onclick components 
Javascript :: mongodb working with date 
Javascript :: react js bootstrap select option required 
Javascript :: automatically click button javascript on setinterval 
Javascript :: blur effect javascript 
Javascript :: buildpack for nodejs 
Javascript :: how to get data form 
Javascript :: enzynme not support react 17 
Javascript :: nuxt auth keep user loggedin on refresh 
Javascript :: lodash find array of strings 
Javascript :: thymeleaf pass variable to javascript 
Javascript :: composer require ozee 31/cakephp-cors:^1 
Javascript :: jest spyon 
Javascript :: nodejs redirect to url 
Javascript :: comentário jsx 
Javascript :: react hooks send data from child to parent 
Javascript :: angular how to copy text with button 
Javascript :: attributes in same line prettier 
Javascript :: js sort strings lowercase and uppercase 
Javascript :: json data types 
Javascript :: get selected option text jquery 
Javascript :: what is node js 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =