Faa*_*rtz 4 html javascript jquery
相当容易,但我没有在网上找到如何做到这一点。
我想要这个元素的第一个 TD(行)
$(document).on("click", "#posTable tr", function() {
alert($(this).('td:first').text());
});
Run Code Online (Sandbox Code Playgroud)
我试过:
alert($(this).('td:first').text());
alert($('td:first', $(this).parents('tr')).text()));
Run Code Online (Sandbox Code Playgroud)
您需要使用find()来获取给定行中的第一个 td。您还可以将this选择器作为上下文传递。
使用find()
alert($(this).find('td:first').text());
Run Code Online (Sandbox Code Playgroud)
alert($('td:first', this).text());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3605 次 |
| 最近记录: |