目前我正在使用$('table').children('tfoot').children('tr').children('td');
才能得到脚踏中唯一的td。
我不喜欢使用.children() 3次,
有更好的办法吗?
编辑
稍加修正,选择器实际上是
var table = this;
$(table).children('tfoot').children('tr').children('td');因为这是在jquery插件中。
发布于 2010-11-19 05:12:11
$('table > tfoot > tr > td')children()在直接子节点中搜索,因此为了复制这一点,我使用了直系后代选择器 (>)。
更新
从你的更新来看,你可以.
$(table).find(' > tfoot > tr > td')或者你可以用table代替this。
我很高兴你是为孩子们着想。
发布于 2010-11-19 05:11:41
$('table>tfoot td');你最好读一下CSS风格的选择器。
关于最新版本:
$('tfoot>td',this);https://stackoverflow.com/questions/4222270
复制相似问题