开发者

JQuery selector for table cells except first/last row/column

is there a way to directly select all 'inner' table cells (<td> elements) o开发者_如何学JAVAf a table (i.e. all cells except the ones in the first and last row and column) using a jquery selector expression?


You can use :not() with the :first-child and :last-child selectors, like this

$('table td:not(:first-child, :last-child)')

To exclude first/last rows as well:

$('table tr:not(:first-child, :last-child) td:not(:first-child, :last-child)')


 $('#table_name tr td:not(:first-child)').each(function () {
                    $(this).html('<input type="text" value="' + $(this).html() + '" />');
                });

Here example how to Skip 1st td of a table(table_name) .U can write :last-child to skip last td to do some task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜