Delete all rows in an HTML table

后端 未结 19 1764
既然无缘
既然无缘 2020-12-04 12:03

How can I delete all rows of an HTML table except the \'s using Javascript, and without looping through all the rows in the table? I have a very huge

19条回答
  •  一生所求
    2020-12-04 12:14

    If you have far fewer rows than non- rows, you could collect all the rows into a string, remove the entire table, and then write

    thstring
    where the table used to be.

    EDIT: Where, obviously, "thstring" is the html for all of the rows of s.

提交回复
热议问题