dom - Jquery wont work on plugin generated html tags -
i developing simple rss aggregator site parses bunch of rss feeds , displays them in series of boxes. using rss plugin, zrssfeed.
you can see live version of site here: http://vitaminjdesign.com/adrian
the problem having using jquery select dom objects generated plugin. more specific, trying display social icons next anchor link when hover on link on page using following jquery:
$(document).ready(function(){ $('a').hover(function(){ $('<a href="#"><img src="images/facebook.gif" class="facebook" alt="facebook"></a>').appendto(this).fadein(500); $('<a href="#"><img src="images/twitter.gif" class="twitter" alt="twitter"></a>').appendto(this).fadein(500); }, function(){ $('a').find('.facebook,.twitter').stop().fadeout(500); }); }); for reason, jquery not work anchors on page. plugin generates tags using jquery script placed above script in html document. cant seem figure out why isnt working!!! have tried various jquery snippets work on other elements of page, plugin generated content doesn't seem affected jquery. help!
this doesn't work because dom has changed since page first rendered, you'll need use live() method. allows generated elements still targeted already-existing jquery functions. http://api.jquery.com/live/
Comments
Post a Comment