How to add items to a unordered list
    using jquery

前端 未结 4 538
猫巷女王i
猫巷女王i 2020-12-07 14:11

In my json response, I want to loop through it using $.each and then append items to a

    element.

        $.each(data, function(         
    
    
            
    4条回答
    •  孤城傲影
      2020-12-07 14:31

      $.each(data, function(i, item) {
      
             var li = $("
    • "); $("#yourul").append(li); $("a",li).text(item.Username); $("a",li).attr("href", "http://example.com" + item.UserID); }

    提交回复
    热议问题