我這個plugin做:jQuery.closest()給出了 「零」 的價值
<table>
<tr>
<td>
<a class="linkType1" href="google.com">
Google
</a>
<span style="display: none;">Goooooooooooogle</span>
</td>
</tr>
<tr>
<td>
<a class="linkType1" href="yahoo.com">
Yahoo
</a>
<span style="display: none;">Yaaaaaaaaaaaaaaho</span>
</td>
</tr>
</table>
如何選擇的linkType1
-anchors的closest
span
顯示爲工具提示?
目前我做的:
jQuery(document).ready(function() {
jQuery("a.linkType1").tooltip({
bodyHandler: function() {
alert(jQuery(this).closest("span").html()); // this alert is showing `null`
return "hi"; // i need to setup the alerted content here
},
showURL: false
});
});
我覺得太多票了...... 7分鐘後會接受。謝謝T.J,那正是我需要的。 +1 – tusar 2012-04-02 08:10:02
你能否看看我的另一個問題? http://stackoverflow.com/q/8937158/778687 – tusar 2012-04-02 08:10:43