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

465
Views
How to check if an element has been unselected using JS?

I'm trying to check if an element has been unselected in a form; So I can check if the input is valid, but i'm stuck at the selected part; I've tried to add onclick() functions but as the div containing my form is selected too when I click on an input field, it's not working. Any ideas ?

this is what I have for a form click :

document.getElementById("contactForm").onclick = function ()
{
  if (messageClicked==1){
    console.log(document.getElementById("formMessage").value);
  }
  
}

and for an input :

document.getElementById("formMessage").onclick = function ()
{
  messageClicked=1;
}
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer is indeed the blur event ! Thanks user19642323 !

about 4 years ago · Santiago Trujillo 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!