我有这个 html 树示例
<div class="auditions_date">
<div class="new_green above_deadline"><a href="/auditions/2 ?>">Contact</a></div>
<span class="aud_recommend"><a class="222" id="aud_recommend" href="#recommend_data">test</a></span>
</div>
<div class="auditions_date">
<div class="new_green above_deadline"><a href="/auditions/3 ?>">Contact</a></div>
<span class="aud_recommend"><a class="333" id="aud_recommend" href="#recommend_data">test</a></span>
</div>
当我单击test
链接时,我想获取标签的href
属性a
也许:
$('a#aud_recommend').on("click", function() {
var j = $(this).parent('.auditions_date').find('a').attr('href');
console.log(j);
});
这似乎无法正常工作..有什么想法吗?
谢谢