What I'm trying to do is add for each items in a xml file their content to a html page.(我想做的是将xml文件中的每个项目的内容添加到html页面。)
I'm trying to make it so that every item content is inside an <article>
tag.(我正在尝试使每个项目的内容都在<article>
标记内。) However, It's my first time using jQuery and my end result is not what I want.(但是,这是我第一次使用jQuery,最终结果不是我想要的。)
let $items = $(xmlContent).find("item");
$items.each(function() {
let title = $(this).find('title').text();
let date = $(this).find('pubDate').text();
let link = $(this).find('link').text();
let guid = $(this).find('guid').text();
let photo = $(this).find('media').html();
$("#world").append("<article></article>", [$("<a>", {
href: link
}) + ("<h3>" + title + "</h3>")]);
This is what the end result currently is:(这是当前的最终结果是:)
<article></article>
[object Object]
<h3>Students Fainting From Hunger in Venezuela’s Failing School System</h3>
And what I want it to become:(而我希望它成为:)
<article> <a href= myLink <h3>Students Fainting From Hunger in Venezuela’s Failing School System</h3> </a> </article>
I want to apply my link so that everywhere the user click on the content it goes to the link.(我想应用我的链接,以便到处用户单击链接的内容。) Hopefully you can guide me.(希望你能指导我。) Thanks!(谢谢!)
ask by Ron translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…