Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
¿Cómo activar la búsqueda con la tecla Intro y hacer clic en el botón javascript?

Quiero activar el botón de búsqueda para que funcione cuando se hace clic en el botón "buscar" y cuando se presiona la tecla Intro en el teclado. Hasta ahora, la búsqueda funciona cuando se hace clic en el botón. ¿Cómo agrego eso a este código?

¡Gracias!

 //Search button click document.getElementById("search").addEventListener("click", () => { //initializations let searchInput = document.getElementById("search-input").value; let elements = document.querySelectorAll(".question-name"); let cards = document.querySelectorAll(".card"); //loop through all elements elements.forEach((element,index) =>{ //check if text includes the search value if(element.innerText.includes(searchInput.toString())){ //display matching card cards[index].classList.remove("hide"); } else { //hide others cards[index].classList.add("hide"); } }) });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

document.getElementById('search').addEventListener('keyup',function(e) { if(e.code==13) {/*your code goes here*/} })

Más información: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!