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

245
Visualizações
is there an alternative to onfocusout() function?

I have the function onfocusout() that runs another function selectEntite(), inside an input like the following code :

<input onfocusout="selectEntite();" type="text" placeholder="Entité" id="entityName" class="inputSelect" name="entityName" style="width: 60%" />

when the user leave the input, the function run. i want to change it until the user tap the keyboard enter.

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

0

Try this:

<input onkeydown="selectEntite(this);" type="text" placeholder="Entité" id="entityName" class="inputSelect" name="entityName" style="width: 60%" />
function selectEntite(ele) {
    if(event.key === 'Enter') {
        alert(ele.value);        
    }
}
about 4 years ago · Juan Pablo Isaza Relatório

0

you can add an addEventListener() to the input field that listens for key presses. Then check if enter is pressed, then you can execute some code. –

let el = document.getElementById("entityName")
el.addEventListener("keydown",(event) => {
    if (event.key === "Enter") {
        // Enter key was hit
    }
})
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