jQuery delete table column

前端 未结 6 610
北荒
北荒 2020-12-17 00:40

I have a table and cannot change markup:

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 01:37

    A column is pretty much just cells, so you'll need to manually loop through all the rows and remove the cell by the index.

    This should give you a good starting point for removing the 3rd column:

    $("tr").each(function() {
        $(this).children("td:eq(2)").remove();
    });
    

提交回复
热议问题