Take the 2-minute tour ×

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>");


And using the following XML:

    <Nav name="Home">
    <Nav name="Twitter">

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
add comment

1 Answer

up vote 4 down vote accepted

Try changing the div to a span

share|improve this answer
yes, by default divs are block-level, meaning they'll clear the element before it and start on a 'new line' so-to-speak. –  DA. Jun 26 '11 at 3:29
add comment

Your Answer


