A live handler is different from a normal handler, and I'm not sure
why you're putting a normal handler inside of a live handler.  A live
handler works by looking at the target of whatever is clicked and
comparing it to the selector, in this case, the thumbnail class.  I
personally prefer to use live handlers for content that is added and
removed dynamically since it is easier to manage.


On Apr 10, 9:30 pm, thought <thou...@orcon.net.nz> wrote:
> Thanks for the swift replies.
>
> I've got a lot to learn about javascript, and at this point, adapting
> charlies code, I get a strange effect that I didn't anticipate, and
> don't understand.
>
>  $('.thumbnail').live("click", function(){
>
>         $("div[id^='thumbnail']").click(function() {
>                 alert( $(this).attr('id') );
>
> });
>
> For the first time I click on a div, I get nothing. No alert.
> For the second time I click a div, the alert pops up a couple of
> times.
> For the third time, the div pops up multiple times - displaying the
> id, and then displaying the name of the class.
>
> I'm guessing that I'm encountering something about js that I don't
> understand.
> If someone were to give me a pointer that explains this behaviour, and
> how to change it I'd be grateful.
>
> Thanks.

Reply via email to