开发者

jQuery table column td:nth-child()

I have a table and I use this code to add a <div class="out"></div> inside the second column cells:

$(".main-vervolg .right .bottom table tbody td:nth-child(2)").append('<div class="out"></div>');

This div go's over the text inside the cells but I don't wa开发者_开发百科nt that the last cell of that column get's that div inside it.


You can use the :not() selector along with the :last selector to achieve that:

$(".main-vervolg .right .bottom table tbody td:nth-child(2):not(:last)").append('<div class="out">out</div>');

Demo

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜