I'm parsing a XML using jQuery with the following code:
function appendNav(xml) {
$(xml).find("Nav").each(function() {
$("#navBar").append("<a id='navItem' href='" + $(this).find("Link").text() + "'>" + $(this).attr("name") + "</a>");
$("#navBar").append("<div class='navItemSep'> | </div>");
});
$(".navItemSep").filter(":last").remove();
}
And using the following XML:
<Navbar>
<Nav name="Home">
<Link>index.html</Link>
</Nav>
<Nav name="Twitter">
<Link>;/Link>
</Nav>
</Navbar>
The problem is that I'm getting this on multiple lines instead of only a single one. What I need to do to make it output this on a single line?
I'm parsing a XML using jQuery with the following code:
function appendNav(xml) {
$(xml).find("Nav").each(function() {
$("#navBar").append("<a id='navItem' href='" + $(this).find("Link").text() + "'>" + $(this).attr("name") + "</a>");
$("#navBar").append("<div class='navItemSep'> | </div>");
});
$(".navItemSep").filter(":last").remove();
}
And using the following XML:
<Navbar>
<Nav name="Home">
<Link>index.html</Link>
</Nav>
<Nav name="Twitter">
<Link>http://twitter./nathanpc</Link>
</Nav>
</Navbar>
The problem is that I'm getting this on multiple lines instead of only a single one. What I need to do to make it output this on a single line?
Share Improve this question asked Jun 26, 2011 at 3:22 Nathan CamposNathan Campos 29.5k62 gold badges200 silver badges307 bronze badges1 Answer
Reset to default 7Try changing the div
to a span