alert($(this).children().next().html());
返回
<a href="thelink.php?id=XXXX">click me...</a>
如何修改上面的语句以仅获取href?
尝试使用attr('href')但无法使其正常工作。
(是的,我是jq新手并且时间紧迫。)
//编辑 - 添加了代码:
<div class="row">
<div class="date">
<h2>27</h2>
<h3>dec</h3>
</div>
<h2><a href="/wpb/index.php?id=4192#4199">the title..</a></h2>
<p>the description...</p>
</div>
jq invoked by:
$("#threecol .row").click(function() {
alert($(this).children().next().href);
});
敬礼,
<h*>
元素进行样式设置。请使用CSS。标题元素具有独特的语义含义。 - Felix Kling