live is no longer a plugin, but core of jquery Paolo
On Wed, Aug 26, 2009 at 10:14 AM, Leonard Martin<leonard.mar...@gmail.com> wrote: > > You will either need to use the live plugin as follows: > > $('#thumbs a').live('click',function(){...}); > > Or move the binding of your 'click' inside the callback function of > your $.ajax call so it would then look like: > > .appendTo('#thumbs').click(function(){...}); > > As it is you're trying to bind onto anchors which don't exist yet. > Using $().live() allows you to bind onto all exisiting elements, and > any elements which may be created in the future. > > > > On Aug 26, 8:54 am, cachobong <f.mngt...@gmail.com> wrote: >> Hello! I need help on this. i created image links by reading an xml >> and creating the img and a tags in jquery. how do i put a function in >> it? i tried the function below but it doesnt seem to work. These image >> links are stored in the div: "thumbs" >> >> Below is the code: >> >> $(function() { >> $("#thumbs a").click(function(event) { >> event.preventDefault(); >> alert("Hello world!"); >> }); >> >> $.ajax({ >> type: "GET", >> url: "thumbs.xml", >> dataType: "xml", >> success: function(xml) { >> $(xml).find('thumb').each(function(){ >> var title_text = $(this).find('title').text(); >> var path_text = $(this).find('path').text(); >> >> $('<a href=""></a>').html('<img src="'+ path_text >> +'" alt="'+ >> title_text +'" title="'+ title_text +'">') >> .appendTo('#thumbs'); >> }); //close each( >> } >> }); //close $.ajax( >> >> }); //close $( >> >> Thank you!!