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

186
Views
¿Cuál es la diferencia entre que un evento del mouse ocurra y no ocurra después de cargar la página?

Traté de detectar un evento de cierre de toque y recibí un mensaje de confirmación. El código es así. Extrañamente, si cierro la pestaña después de que ocurre el evento del mouse (haciendo clic en cualquier lugar), el mensaje de confirmación aparece normalmente, pero si el evento del mouse no ocurre, la ventana del mensaje no aparece y simplemente aparece. ¿Cuál es la diferencia entre que ocurra un evento del mouse y no ocurra después de cargar la página?

 $(function(){ var validNavigation = false; //Attach the event keypress to exclude the F5 refresh (includes normal refresh) $(document).bind('keypress', function (e) { if (e.keyCode == 116) { validNavigation = true; } }); // Attach the event click for all links in the page $("a").bind("click", function () { validNavigation = true; }); // Attach the event submit for all forms in the page $("form").bind("submit", function () { validNavigation = true; }); // Attach the event click for all inputs in the page $("input[type=submit]").bind("click", function () { validNavigation = true; }); window.onbeforeunload = function () { if (!validNavigation) { return "Do you really want to close?"; } validNavigation = false; }; });
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!