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

181
Views
Why Isn't My Button Event Being Triggered After The First Try

I am making a game and right now I'm trying to make a save feature and I have made it so you can click out of it, but my problem is when you click on the button again the screen doesn't work. Can you please help me out

Javascript

function savingGame() {
  document.getElementById('saveScreen').style.display = "block"
  document.getElementById('content').style.marginTop = '-83vh';
}

function saveGame1() {
  if (localStorage.getItem('save1') != null) {
    overwriteAlert();
  } else {
    localStorage.setItem('save1', index)
    alert('gameSaved');
    saveScreen.style.display = "none"
    content.style.marginTop = "-3vh"
  }
}

function noSave() {
  if (window.getComputedStyle(saveScreen).display == "block") {
    document.getElementById('content').onclick = function() {
      saveScreen.style.display = "none"
      content.style.marginTop = "-3vh"
    }
  }
}
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!