OFFTTOP: The live() function will reduce so much questions on this mailing list :)
---- Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Wed, Jan 14, 2009 at 6:52 AM, Kean <shenan...@gmail.com> wrote: > > using jQuery 1.3 > > This will most probably work. > > $('#grabMe').live('click', function() { > alert($(this).html()); > }); > > On Jan 13, 5:41 pm, Kean <shenan...@gmail.com> wrote: >> Hmmm, you must understand event listener(bind) does not work like CSS >> where DOM nodes added in the future cannot be listened right now. >> That's where event delegation comes it. >> >> http://www.learningjquery.com/2008/03/working-with-events-part-1 >> >> On Jan 13, 4:58 pm, sam <sam.from.hackern...@gmail.com> wrote: >> >> > $('#grabMe') will search the document for an element with ID "grabMe" >> >> > Have you added grabMe to the document? >> >> > On Jan 13, 6:00 pm, CrustyDOD <anze.stok...@gmail.com> wrote: >> >> > > Hey! >> >> > > I've created one div with FlyDOM plugin which uses createElement >> > > function to add stuff to DOM. Now the problem is that once i add the >> > > element, i cannot access it in anyway. >> >> > > For example with FlyDOM plugin i create: >> > > <div id="grabMe">It works!</div> >> >> > > After the JS for creating element i have this: >> > > $('#grabMe').click(function() { >> > > alert($(this).html()); >> >> > > }); >> >> > > It doesn't work. >> >> > > There are no errors shown in Firebug, the element is in DOM, id is >> > > set. It's all there. >> >> > > Am i missing something here? I'm confused :S >> >> > > Using jquery 1.2.6