[jQuery] a problem with 1.1.4 and binding click function
I dont know if this is a problem in jquery or have I did something
wrong.
Please take a look at this code it is for a gallery of a sort,
What I want to achieve is that when image with class poster_image is
clicked the div with class poster_info is shown.
But what happens is that there are more of poster_holders on a page
and it simulates for every poster_holder class a click but only to the
current poster_holder, resulting in constant showing and hiding of the
poster_info class the same number of times as there are poster_holder
classes on the page.
<div class="poster_holder">
<ul style="float: left; vertical-align: bottom; width: 95px;"
class="poster">
<li class="poster">
<img class="poster_image" src="0402.jpg" /></li>
<li class="poster_options_left" id="0402">
<img width="16" height="16" src="images/record_(delete)_16x16.gif"
alt="Remove" title="Remove"/></li>
<li class="poster_options_right" id="0402022">
<img width="16" height="16" src="images/record_(edit)_16x16.gif"
alt="Add"/></li>
</ul>
<div class="poster_info" style="display: none">
<ul class="poster">
<li><h1></h1></li>
</ul>
</div>
</div>
The code is simple
$(".poster_image").click(function (){
$(this).parents("div").children(".poster_info").toggle(400);
}
Does anyone have a idea why is this happening? Did I missunderstud
something? Prior jquery did everything nicely.