获得此行的第一个TD [英] Get first TD of THIS row
本文介绍了获得此行的第一个TD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
相当简单,但我没有找到如何在线进行此操作。
Fairly easy yet i did not find how to do this online.
我想要这个元素的第一个TD(行)
I want the first TD of the this element (row)
$(document).on("click", "#posTable tr", function() {
alert($(this).('td:first').text());
});
我试过:
alert($(this).('td:first').text());
alert($('td:first', $(this).parents('tr')).text()));
推荐答案
你需要使用 find()
获取给定行中的第一个td。你也可以在选择器中传递 this
作为上下文。
You need to use find()
to get the first td in the given row. You can also pass this
in selector as a context.
使用 find()
alert($(this).find('td:first').text());
使用 jQuery(selector [,context])
alert($('td:first', this).text());
这篇关于获得此行的第一个TD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文