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

228
Visualizações
Is it possible for input to be always focused like in Telegram desktop app?

I have a question. Is it possible for input to be always focused like in Telegram desktop app?

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If they did it for Telegram desktop then it must be possible, right? Just a matter of how.

There's a few ways to do this.

You can use the autofocus attribute as Ram mentioned in the comment. Simple, but I like to avoid HTML attributes for this kind of DOM manipulation because you're at the mercy of the browser understanding and implementing the attributes.

You can also give it a tabindex 1, but that means you'll have to keep track of your tabindexes for all focusable elements.

You can also write up a quick function under document ready like

$(document).ready(function() {
    $('#InputFieldID').focus();
});

These are only a few solutions I could think of off the top of my head.

about 4 years ago · Juan Pablo Isaza Relatório

0

The simplest way is this:

document.getElementById("myInput").focus();
    document.getElementById("myInput").addEventListener("blur", (e) => {document.getElementById("myInput").focus()})
<input id="myInput">

I hope I helped you

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