How to transform HTML table to list with JQuery?

后端 未结 4 1764
暖寄归人
暖寄归人 2020-12-20 00:38

How would I transform a table



        
      
      
      
4条回答
  •  暖寄归人
    2020-12-20 00:48

    You could try:

    function convertToList() {
      var list = $("
      "); $("table tr").each(function() { var children = $(this).children(); list.append("
    • " + children[0].text() + "

      " + children[1] + "

    • "); } $("table").replaceWith(list); }

    提交回复
    热议问题
    Name Price