javascript - Do I need e.stopPropagation() and e.preventDefault()? -
in javascript/jquery, registering click , touchstart events on button, this:
$('#open-about-popup').on('touchstart click', openaboutpopup_eventhandler) then in event-handler, have this:
e.stoppropagation(); e.preventdefault(); this causing next button-click not fire. have wrong?
thanks.
e.stoppropagation() prevents event bubbling dom tree, e.preventdefault() prevents browser doing whatever default behavior associated event - e.g. click event on <a> tag make browser redirect href of link, if use preventdefault, won't that.
Comments
Post a Comment