Add table row in jQuery

前端 未结 30 3059
既然无缘
既然无缘 2020-11-21 05:40

What is the best method in jQuery to add an additional row to a table as the last row?

Is this acceptable?

$(\'#myTable\').append(\'

        
30条回答
  •  离开以前
    2020-11-21 06:17

    What if you had a and a ?

    Such as:

    Foo
    footer information

    Then it would insert your new row in the footer - not to the body.

    Hence the best solution is to include a tag and use .append, rather than .after.

    $("#myTable > tbody").append("row content");
    

提交回复
热议问题