lundi 28 août 2017

how to append the list using jquery

Basically, i try to append a list using jquery. Each element in this list is connected to a different link. This is what i done

for (i=0; i <data.length ; i++ ){

        var a = $('<a />');
        a.attr('href','http://ift.tt/2xq6IoM' + data[i].key);
        a.text(data[i].name);


        $("#list-of-project ul").append("<li>").append(a).append("</li>");


    }

"data" here is an JSON array i get from REST having key and name attribute. However, using this , i got output like this unwanted result. The element not at the same line with the list points. I want the text to be at the same line with the list points. Any help??




Aucun commentaire:

Enregistrer un commentaire