jQuery remove HTML table column

后端 未结 11 1399
粉色の甜心
粉色の甜心 2020-12-13 07:13

I have a HTML table like this:

DE
11条回答
  •  一向
    一向 (楼主)
    2020-12-13 08:08

    A generic way (not tested):

    $("a.delete").click(function() {
       var colnum = $(this).closest("td").prevAll("td").length;
    
       $(this).closest("table").find("tr").find("td:eq(" + colnum + ")").remove();
    }
    

    No need to change markup.

提交回复
热议问题