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

183
Views
¿Cómo puedo dejar que un elemento haga dos eventos al mismo tiempo?

Entonces, estoy jugando y quiero que el usuario restablezca el puntaje cuando haga clic en el botón y restablezca los límites cuando pase el mouse sobre él. ¿Cómo puedo hacerlo para que él pueda pasar el mouse y hacer clic?

 function reset_bounderies() { let start = document.getElementById("start") start.addEventListener("mouseover", function (event) { game = true; document.querySelectorAll(".boundary:not(.example)").forEach(item => { item.classList.remove("youlose") document.getElementById("status").innerHTML = `Begin by moving your mouse over the "S".` }) }) start(); }

y la segunda funcion

 function reset_game() { let start = document.getElementById("start") start.addEventListener("click", function (event) { game = true; score = 0; print_score() }) start(); }

PD: no puedo editar archivos html o css

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede agregar dos EventListener diferentes a su botón

 function functionOne(){ console.log("functionOne") } function functionTwo(){ console.log("functionTwo") } const myButton = document.getElementById("myButton") myButton.addEventListener('click', functionOne) myButton.addEventListener('mouseover', functionTwo)
 <button id="myButton">Click me !</button>

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!