var src = jQuery('.ovh header h2 a').attr("href");
jQuery('.entry-content').after('<a href="' + src_should_be_here + '">Continue reading >></a>');
我正在使用此代码添加指向所有帖子的链接,但我无法从标题中的链接中获取 href,如下所示:
header > h2 > a
并且 entry-content 类就在标题 div 之后。我试过这个:
var src = jQuery('.ovh header h2 a').attr("href");
但它只选择第一个帖子的链接而不是每个帖子
HTML:
<header>
<div class="entry-meta post-info">
<!-- <span class="byline author vcard">By <a href="http://appfessional.com/new/author/admin1/" rel="author" class="fn">Kitejock Team</a>,</span>-->
<span class="post-tags"><a href="http://appfessional.com/new/tag/canada/" rel="tag">canada</a> <a href="http://appfessional.com/new/tag/gear-2/" rel="tag">gear</a> <a href="http://appfessional.com/new/tag/np/" rel="tag">np</a></span>
<a href="http://appfessional.com/new/satisfy-your-thirst-with-np-2014-collection/#respond" title="Comment on Satisfy Your Thirst with NP 2014 Collection">Leave a comment</a>
</div>
<h2><a href="http://appfessional.com/new/satisfy-your-thirst-with-np-2014-collection/">Satisfy Your Thirst with NP 2014 Collection</a></h2>
</header>
<div class="entry-content">
<p>NP brings the 2014 collection of waterwear and accessories, all designed to enhance the riding experience and to provide comfort, protection and style to every rider. Share their 40 year obsession for water and decide for yourself. www.npsurf.com</p>
</div>