jan*_*mon 18
jQuery 1.1.4引入了last-child选择器:
描述:选择作为其父项的最后一个子项的所有元素.
while:last只匹配一个元素:last-child可以匹配多个:每个父元素一个.
$("table:first tr td:last-child");
Run Code Online (Sandbox Code Playgroud)
$('table:first tr').each(function() {
var lasttd= $(this).find(':last-child')
//your code
});
Run Code Online (Sandbox Code Playgroud)
循环遍历每个tr并获取最后一个td :last
$('table:first tr').each(function(){
$(this).find('td:last').addClass('LastTD');
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
48676 次 |
| 最近记录: |