Looks like this will work.  Thanks for your help.

On Sep 15, 4:29 pm, Charlie Griefer <charlie.grie...@gmail.com> wrote:
> Have a look at live()
>
> http://docs.jquery.com/Events/live
>
> "Binds a handler to an event (like click) for all current - and future -
> matched element."
>
> Basically, when you add elements to the DOM dynamically after page load,
> jQuery won't recognize those elements unless the live() method is used.
>
>
>
> On Tue, Sep 15, 2009 at 4:20 PM, rob <rob.sche...@gmail.com> wrote:
>
> > Hello,
>
> > I am having some problems with selectors and events.  I have a row of
> > thumbnails all part of the "thumbnails" class.  I'm trying to run some
> > code when a thumbnail is clicked, but something weird is happening.
>
> > When i use this selector/event:
> > " $(".thumbnails").click(function(){ // run some code });
>
> > nothing happens.
>
> > I've tested this:
> > " $("img").click(function(){ // run some code });
>
> > And the code does run on what seems like all <img> that are set in the
> > HTML doc, but not the <img> elements that are created from JQuery
> > script.
>
> > Can anyone help to explain this?  What am I doing wrong here?
>
> > For reference:
>
> > The jquery script creating elements is:
>
> > $(function(){
> > var image = new Image();
>
> > $(img).attr('src', path)
> > $(img).attr('class', "thumbnails");
>
> > $('#thumbnailwrapper').append(img);
>
> --
> I have failed as much as I have succeeded. But I love my life. I love my
> wife. And I wish you my kind of success.

Reply via email to