-1

In JavaScript/jQuery, I am registering click and touchstart events on a button, with this:

$('#open-about-popup').on('touchstart click', openAboutPopup_eventHandler)

Then in the event-handler, I have this:

e.stopPropagation(); 
e.preventDefault();

This is causing the next button-click not to fire. Do I have something wrong?

Thanks.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
Talal
  • 103
  • 3
  • 10

2 Answers2

2

e.stopPropagation() prevents the event from bubbling up the DOM tree, e.preventDefault() prevents the browser from doing whatever default behavior is associated with the event - e.g. a click event on an <a> tag will make the browser redirect to the href of the link, but if you use preventDefault, it won't do that.

Jeff
  • 12,085
  • 12
  • 82
  • 152
-1

I fund the problem. It is unrelated to the post. Thanks.

Talal
  • 103
  • 3
  • 10