开发者

jQuery table column td:nth-child()

开发者 https://www.devze.com 2023-03-16 01:58 出处:网络
I have a table and I use this code to add a <div class=\"out\"></div> inside the second column cells:

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

精彩评论

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