get row by index

前端 未结 9 937
名媛妹妹
名媛妹妹 2020-12-17 16:35

how can you get a row by the index?

var rows = $(\'tr\', tbl);
rows.index(0).addClass(\'my_class\');
9条回答
  •  一向
    一向 (楼主)
    2020-12-17 17:05

    You can use nth-child in your selector:

    $('tr td:nth-child(3)').addClass('my_class');
    

    Will get the third td.

提交回复
热议问题