How to get a table cell value using jQuery?

后端 未结 9 1193
终归单人心
终归单人心 2020-11-22 14:41

I am trying to work out how to get the value of table cell for each row using jQuery.

My table looks like this:

9条回答
  •  长情又很酷
    2020-11-22 15:26

    a less-jquerish approach:

    $('#mytable tr').each(function() {
        if (!this.rowIndex) return; // skip first row
        var customerId = this.cells[0].innerHTML;
    });
    

    this can obviously be changed to work with not-the-first cells.

提交回复
热议问题