1

There is a clickable layer. On click it reveals/hides some extra content. Within this layer there is a link which triggers another page to load in the browser.

When this link is clicked the clickable layer is clicked too because it contains the link. How can I avoid that?

I want the link to work but while the user clicks on it the extra content should not be shown.

I tried with

$('.link').click(function(event){
     return false;      
});

but this disables both hide/show and the link to work. Any ideas? Here is my fiddle: http://jsfiddle.net/ZkPLD/

DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
  • Duplicate: http://stackoverflow.com/questions/6088339/jquery-stop-click-action-after-first-elevent – Dave R Oct 16 '12 at 18:39

1 Answers1

4

Use stopPropagation to avoid events bubbling up:

$('.link').click(function(event){
     event.stopPropagation();
});
Mahn
  • 16,261
  • 16
  • 62
  • 78