javascript - Avoid jQuery click function on <a href=""> elements -


this question has answer here:

i have following click function on div element. inside div element links. how can stop click function on links? tried z-index doesn't work.

$('.thumb.flip').click(function () {  if ($(this).find('.thumb-wrapper').hasclass('flipit')) {      $(this).find('.thumb-wrapper').removeclass('flipit');  } else {      $(this).find('.thumb-wrapper').addclass('flipit');  } }); 

add code stop click propagating links dom div:

$('a').click(function(e){e.stoppropagation();}) 

see http://api.jquery.com/event.stoppropagation/

jsfiddle example


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -