jQuery how to take the href of a link in a child element and use it somewhere else -
my page has link @ bottom i've assigned id to...
<a id="nbwalink" class="learn-more"> learn more </a>
above this, there rss feed inserting page outputs it's first link as...
<div id="rssincl-box-767647"> <div class="rssincl-content"> <div class="rssincl-entry"> <p class="rssincl-itemtitle"> <a target="_blank" href="http://something.com/somesubfolder/somepage.html"> description of link </a> </p> ...you idea.
i trying use jquery this...
var nbwahref = $('.rssincl-itemtitle').children('p').eq(0).attr('href'); $('#nbwalink').attr('href',nbwahref);
...to steal link rss link , apply the learn more button. there way this, can't work? =t
your selector wrong because p
not child of rssincl-itemtitle
element, p
rssincl-itemtitle
element, need find child of p
element
var nbwahref = $('.rssincl-content .rssincl-itemtitle:first a').attr('href'); $('#nbwalink').attr('href',nbwahref);
Comments
Post a Comment