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

236
Views
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 answers
Answer question

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 Report

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