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
精彩评论