How to create list in HTML dynamically?

前端 未结 2 813
盖世英雄少女心
盖世英雄少女心 2021-02-01 10:16

In my jQuery mobile app, I want to display the result from a web service in a list. How do I create the list dynamically?

2条回答
  •  梦谈多话
    2021-02-01 10:29

    var arr = ["list", "items", "here"];
    $("div").append("
      "); for(var i in arr) { var li = "
    • "; $("ul").append(li.concat(arr[i])) }
    提交回复
    热议问题