views:

53

answers:

2

I have some popup dialogs on my webpage, in each of this dialogs i have defined some click event with jquery :

 $(".links_view").click(function(e){          //code     });

But the problem is when i activate one this click event, it will be executed in each dialog...

+2  A: 
$(".links_view").click(function(e){  e.preventDefault()   });

also have your dialogs different class OR id!?

aSeptik
A: 

I believe you want to isolate your click attachment; to do this, just make your selector (currently ".links_view") more specific.

For example, if you have the following HTML

<div id="one">
  <button class="links_view">Hi</button>
</div>
<div id="two">
  <button class="links_view">Ho</button>
</div>

the code $('.links_view') will grab both, but you can use $('#one .links_view') to just get the first or $('#two .links_view') for the second.

Here's a good tutorial on selectors: http://reference.sitepoint.com/css/selectorref

Jared Forsyth