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

103
Views
Conditional onkeyup event

Currently I'm using the following:

document.onkeyup = function (data) {
    if (data.key == 'Escape') {
        ClosePlayerMenu()
    }
};

However I'm having two separate menus. A PlayerMenu for normal users, and a Staff menu for Staff members. Everything works but I can't use the current code twice, one to close the Player Menu and one to close the Staff menu as it makes one of the two menus no longer close. So I'm trying to make the key conditional that if PlayerMenu is open, ESC will close it, if Staff Menu is open it will close that. What would be the best approach?

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