get row by index

前端 未结 9 934
名媛妹妹
名媛妹妹 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:25

    Using either the eq() function:

    rows.eq(0).addClass('my_class');
    


    Or the :eq() selector:

    $('tr:eq(0)', tbl).addClass('my_class');
    

提交回复
热议问题