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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -