Can you give a little more detail on the markup? Is there a chance those elements are nested inside each other?
On Mar 24, 6:16 am, MorningZ <morni...@gmail.com> wrote: > You're probably rebinding that event multiple times > > try > > jQuery('.wp_sl', my_frame).unbind().click( function() { alert > ("hi") }); > > markskilb...@googlemail.com wrote: > > I'm listening to some generated elements in an iframe. These elements > > are given the class 'wp_sl'. I need to, when an element with this > > class is clicked, do some work with it. However, say I have generated > > 3 elements with the class 'wp_sl': > > > ---- > > > el_1, el_2, el_3 > > > ---- > > > Using the code below, if I click on the first element, I will be given > > an alert 3 times. If I click on the second, 2 times. And on the third, > > I will be alerted 1 time. > > > I'm unsure why this is happening, because I can do the same outside of > > an iframe, and it works perfectly - only alerting for the element I > > click on. > > > Code: > > > [code] > > var my_frame = jQuery('#content_ifr').contents(); > > jQuery('.wp_sl', my_frame).click( function() { alert("hi") }); > > [/code]