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

125
Views
Navegar/moverse por la lista desplegable con las teclas de flecha y elegir el valor presionando Intro

Al ingresar texto en el campo de texto, ofrece valores similares mostrándolos en la lista desplegable. ¿Cómo podría moverme a través de él usando las teclas de flecha? ¿Y elegir algún valor presionando el botón Intro? ¿Algún consejo para mejorar mi código?

 (function() { "use strict"; let inputField = document.getElementById('input'); let ulField = document.getElementById('suggestions'); inputField.addEventListener('input', changeAutoComplete); ulField.addEventListener('click', selectItem); function changeAutoComplete({ target }) { let data = target.value; ulField.innerHTML = ``; if (data.length) { let autoCompleteValues = autoComplete(data); autoCompleteValues.forEach(value => { addItem(value); }); } } function autoComplete(inputValue) { let destination = [ "A, 1", "B, 2", "C, 3", "D, 4", "E, 5", "F, 6", "A, 7", "B, 8", "C, 9", "D, 10" ]; return destination.filter( (value) => value.toLowerCase().includes(inputValue.toLowerCase()) ); } function addItem(value) { ulField.innerHTML = ulField.innerHTML + `<li>${value}</li>`; } function selectItem({ target }) { if (target.tagName === 'LI') { inputField.value = target.textContent; ulField.innerHTML = ``; } } })();
 <input id="input" autocomplete> <ul id="suggestions"></ul>

about 4 years ago · Juan Pablo Isaza
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!