How can I use jQuery to convert an HTML table into
's?

前端 未结 3 1488
青春惊慌失措
青春惊慌失措 2020-12-09 07:18

How could I go about converting an HTML table (I will provide code below) into

elements? Long story short, I am using a PHP script that outputs cont
3条回答
  •  不思量自难忘°
    2020-12-09 07:47

    Long story short, I am using a PHP script that outputs contents into an HTML table and it has proven very difficult to edit the PHP and convert the table elements into 's.

    Using tables for non-tabular contents is frowned upon. However, if you've already served content in a table, and it looks well, you should not use jQuery to turn the table in divs, just to get rid off the table.

    If you still want to use jQuery to turn the table in a div, you have to consider the structure of the

    elements. Then, loop through each table row, loop through each table cell, and move the contents to a newly created
    . At the end, replace the table with the set of
    s.

提交回复
热议问题