Event.observe(window, 'load',
function() {
$$('a.tag_links').each(function(s) {
//alert(s.parent.parent.id); //How to get id of its parent to parent
});
}
);
我想获取父元素的id。如何使用原型获取锚标记的父ID?
结构是这样的。
<div class="home-page" id='entity-1'>
<div class="index-page-category">
<a href="/entities/category/food" class="tag_links">food</a>
</div>
的结果应该是实体-1
感谢你..它工作... – 2010-07-20 11:22:54