【发布时间】:2013-11-26 13:31:03
【问题描述】:
我有一个带有这种形式的 html 表格:
<html>
<table>
<thead>
<tr>
<th idth='keyth'></th>
</tr>
</thead>
<tbody>
<tr>
<td class='edit' idtd='keytd'></td>
</tr>
</tbody>
</table>
</html>
现在我想在 jquery 中检索离开编辑类的属性“keyth”的内容。 示例:
$(".edit") {
"th_id": this.parentNode.....childNode.getAttribute("idth"),
//Here I dont know how to achieve the attribute content
});
感谢您的建议!!!
我终于找到了一个只用 Javascript 的解决方案:
"th_id":this.parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].getAttribute("idth")
【问题讨论】:
-
看看我的回答。
标签: javascript jquery nodes