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

239
Views
Cómo ejecutar una función antes de llamar a otra función

Tengo un botón con onClick llamando a una función que desafortunadamente no puedo cambiar. Esta función realiza un inicio de sesión en la aplicación:

 <Button onClick={() => signIn()}>

pero necesito ejecutar otro código para verificar si el usuario ha marcado algunas casillas de verificación. ¿Hay alguna manera de llamar a otra función antes de la actual y evitar la llamada de función si la primera devuelve falso?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede obtener el antiguo valor onclick , luego reemplazarlo con su función que llama al original cuando termina de verificar.

 let oldFunc = button.onclick; button.onclick = function(event) { // code to check if the checkboxes are checked if (boxes_checked) { if (typeof oldFunc == 'string') { eval(oldFunc); } else { return oldFunc(event); } } }
about 4 years ago · Santiago Trujillo 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!