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

223
Views
debugging JS on mobile browser - focus function not working

Right, so I'm having some issues with focusing on elements on mobile browsers. Desktop works fine. I've tried click and focus but neither are working so I'm thinking it's maybe something to do with the way I'm identifying it. I know it's a little convoluted and messy but if there's a way to emulate a tab key press this would also work.

Effectively I have 5 inputs and when a single key press is detected in one, I want to move the user to the next one. The way the html is structured though means they are not siblings. I had them as siblings before and choosing nextSibling was working.

Any help appreciated. TIA

 {
            x = document.activeElement.id
            setTimeout(function () {
                document.getElementById("input" + (parseInt(x.toString().charAt(x.toString().length - 1)) + 1).toString()).focus()
                document.getElementById("input" + (parseInt(x.toString().charAt(x.toString().length - 1)) + 1).toString()).click()
            }, 10);

     }
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!