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
La función se ejecuta dentro del clic del botón automáticamente como comportamiento predeterminado

Tengo el código a continuación. Allí testFunction se ejecuta automáticamente cuando se ejecuta el clic del botón (comportamiento predeterminado del CMS que estoy usando. Quiero anular ese comportamiento saltándolo al ejecutar al hacer clic en el botón). Quiero omitir la ejecución de la función de llamada llamada testFunction cuando se ejecuta el clic del botón. Intenté a continuación sin éxito. Cualquier entrada muy apreciada.

 $(".classTest:not(selected)").find("button").on("click", function (){ function testFunction(element,isSelected) }); function testFunction(element, isSelected)(){ //code }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Una opción podría ser agregar un oyente a un elemento externo (como la ventana) y, al hacer clic, ver si el objetivo es uno de esos botones y, si lo es, llamar a stopPropagation en el evento para evitar que alcance el botón.

 window.addEventListener( 'click', (e) => { if (e.target.matches('.classTest button')) { e.stopPropagation(); // if you want something to happen when the button is clicked // put the code here } }, true // add listener to capturing phase, not bubbling phase );
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!