jQuery Event propagation, when using different event types -


i have set jsfiddle show issue have. http://jsfiddle.net/fy8tk/3/

in simple terms, have child element has both single click , double click trigger. both handled within click event using timeout.

the parent term has double click event. defined using dblclick however. event.stoppropagation() not working, , i'm wondering if because different event types?

basically, need parent dblclick event not fire if clicking on child element.

$('.parent').bind('dblclick', function (e) {     if (e.target !== 'div.child') {         alert('double click parent');     } }); $('.child').bind('click', function(e) {     alert('single click child'); }); 

jsfiddle

from jquery documentation on 'dblclick' : it inadvisable bind handlers both click , dblclick events same element. sequence of events triggered varies browser browser, receiving 2 click events before dblclick , others one. double-click sensitivity (maximum time between clicks detected double click) can vary operating system , browser, , user-configurable.

you can refer this question


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -