【发布时间】:2010-01-08 21:20:50
【问题描述】:
问这个问题我感觉很愚蠢,但我想不出一个干净的方法来写这个......
这是 HTML
<li>
<a class='link_parent' href='#'>Test</a>
</li>
我希望父LI的点击功能用.link_parent重定向a的href...
所以...
$('a.link_parent').each(function() {
$(this).parent().click(function() {
// Need to access $(this).attr('href') of the above object
// but can't since $(this) is now the <li> object
// help!
});
});
【问题讨论】: