Xius-Chronus
New Member
I'm trying to nest an \[code\]<a>\[/code\] tag within my \[code\]<li>\[/code\] tag when looping through some JSON data, but it isn't:\[code\]var ul = $('<ul/>');$.each(data.headlines, function() {var linkFromJson = "<a>" + this.headline + "</a>";linkFromJson = $(linkFromJson).attr("href", this.links.web.href).attr("target", "_blank");var listItem = document.createElement('li');ul.append(listItem, linkFromJson);});// append this list to the document body$('body').append(ul);\[/code\]What i get is a \[code\]<li></li>\[/code\] and the \[code\]<a>\[/code\] tag follows, but it displays the hyperlink correctly. When I write the code out to nest the json, it gives me \[code\][object][Object]\[/code\] back after it loops through the items for each \[code\]<li>\[/code\] tag.What am I doing wrong?Thanks!