Getting text from td cells with jQuery

后端 未结 5 1496
有刺的猬
有刺的猬 2020-12-11 00:00

I have this code in jQuery:

children(\'table\').children(\'tbody\').children(\'tr\').children(\'td\')

Which gets all table cells for each r

5条回答
  •  一整个雨季
    2020-12-11 00:41

    I would give your tds a specific class, e.g. data-cell, and then use something like this:

    $("td.data-cell").each(function () {
        // 'this' is now the raw td DOM element
        var txt = $(this).html();
    });
    

提交回复
热议问题