How to dynamically add a new column to an HTML table

前端 未结 5 1024
一生所求
一生所求 2020-12-14 02:03

I have a table to which I am currently dynamically adding rows: http://jsfiddle.net/fmuW6/5/

Now I\'d like to add a new column to the table as well with a click of a

5条回答
  •  一生所求
    2020-12-14 02:31

    Use this code for adding new column:

    $('#btnAddCol').click(function () {
        $("tr").append("New Column");
    });
    

    But you need to change the value for the first row with a text and others to include a . And it is better to

提交回复
热议问题