is there a way to directly select all 'inner' table cells (<td>
elements) of a table (i.e. all cells except the ones in the first and last row and column) using a jquery selector expression?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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)')
回答2:
$('#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.