My issue is that the code I currently have produces some of the divs, but all the news titles, descriptions and images etc appear in the them divs rather than these pieces of take being in a separate div.
$(bbc1).find("item").each(function(){
var title;
var desc;
var tnail;
title = $(this).find('title').text();
desc = $(this).find('description').text();
tnail = $(this).find('thumbnail').last().attr("url");
$('#thumbHome').append("<div class='col-sm-3' />");
$('.col-sm-3').append("<div class='thumbnail' />");
$('.thumbnail').append("<img src='"+ tnail +"'/>");
$('.thumbnail').append("<div class='caption' />");
$('$this').append("<h4>" + title + "</h4>");
$('$this').append("<p>" + desc + "</p>");
});
});
This is what I have so far, but it currently is not working
First of all, I don't get what are you searching for with these lines:
title = $(this).find('title').text();
desc = $(this).find('description').text();
tnail = $(this).find('thumbnail').last().attr("url");
It tries to find elements: <title>, <description>, <thumbnail>
. Is this right? Maybe it is ids ("#title") or classes (".title")?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.