Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

224
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda