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

247
Views
How to select input tag on keypress

Hey I have a list of input tags , I am navigating through all input tags using arrowUp and arrowDown keys I want to select input tag on pressing enter key and start typing.

<input type="text" /> selected and start typing on keypress enter
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Try this :

var el = document.getElementById("myInputID");
el.addEventListener("keydown", function(event) {
    if (event.key === "Enter") {
        // Enter key was hit
    }
});
about 4 years ago · Juan Pablo Isaza Report

0

let's imagine you have <div class="container"> with list of inputs:

<div id="container">
    <input type="text" value="1">
    <input type="text" value="2">
    <input type="text" value="3">
</div>

    document.getElementById('container').querySelectorAll('input').forEach((node) => {
      node.addEventListener('keydown', (event) => {
        if (event.key === 'Enter') {
          // your logic here
        }
      })
    })
about 4 years ago · Juan Pablo Isaza Report

0

    <input type="text" id="text1"><script>
    window.addEventListener("keydown", (event)=>{if (event.key == 'Enter') {document.getElementById("text1").focus()} })</script>

but this works only if you have one element

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!