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

92
Views
Click after preventDefault not doing the default

I have a situation where I need to stop a click on an a tag based on some async stuff. This is inside an Angular Js directive that is attached to a tags, but I don’t think it is relevant.

—-getting the elem
$elem.bind(‘click’, (event) => {
event.preventDefault();
event.stopImmediatePropagation();
-- do the async stuff
—- assume continue case
$elem.unbind(event) —- do not want this handler to execute again
$elem.click();
}

Now the other handlers attached to the element are executed, but the default behavior of navigating to the href is not happening. What have I done wrong or omitted?

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!