我的主要文件是
<div id="man">
//some content
<div id="one">
//some content
<div id="two">
//some content
<div id="three">
//some content
<div id="four">
<a title="to delete">delete</a>
<a title="to reset">reset</a>
<a title="to change">change</a>
</div>...// all div ends...
<div id="woman">
//some content
<div id="one">
//some content
<div id="two">
//some content
<div id="three">
//some content
<div id="four">
<a title="to delete">delete</a>
<a title="to reset">reset</a>
<a title="to change">change</a>
</div>...// all div ends...
而jQuery是 -
$("document").ready(function(){
$("a:contains(delete)").click(function(){
alert($(this).parent().parent().parent().parent().parent().attr("id"))
})
})
有没有其他方法可以找到顶级父母而不是使用这个......??