jquery selecting all elements except the last per group

后端 未结 2 905
被撕碎了的回忆
被撕碎了的回忆 2020-12-30 19:30

I have a table that looks like:

onetwothreelast<
2条回答
  •  梦毁少年i
    2020-12-30 20:28

    $('tr').find('td:not(:last)').css('background-color', 'red');
    

    Translates to: for each element in $('tr') selector, do a find() for all tds that are not last.
    New result is about tds now, so you can apply .css() as wanted.

提交回复
热议问题