I have a div `<div id="articles-feed">` into which I'm trying to append some more stuff. I am getting some JSON data which I parse with `JSON.parse`, format a bit and then try to add to my code.

The thing is, the parsed data contains an array of categories, and I need to display all of them, so I figure I'd just do an `.append` 3 times, with a `for-loop` in between to get the relevant data.

Now a strange thing happens when I run my function, a `</div>` gets added after my first `.append`, so the 2nd and 3rd `.append` get added OUTSIDE of the `<div class="article-box">`. If I try to target the class directly using `$('.article-box')` for my 2nd `.append`, nothing happens.

Can anyone figure out what I'm doing wrong?

My HTML:

```
<div id="articles-sidebar">
    <h2>Search articles archive:</h2>
    <form id="searchbox" method="post">
        <input name="searchword" type="text" placeholder="author, title, keyword...">
        <input type="submit" value="Search">
    </form>
</div>
<div id="articles-feed">
</div>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="js/articles.js"></script>

```

my jQuery:

```
    for(var x = 0; x<response.length; x++) {
        //format date
        var posted = new Date((response[x].posted * 1000));
        //format extract line brakes
        var extract = response[x].extract.replace(/(\r\n|\n|\r)/gm,"<br>");
        //format categories
        var categories = response[x].cat_name.split(",");
        //append JSON to HTML

        $("#articles-feed").append(
            '<div class="article-box"><h1><a href="#">'+response[x].title+
            '</a></h1><h3><a href="#">' +response[x].name+
            '</a>&nbsp;|&nbsp;'+ posted.toLocaleDateString()+
            '</h3><ul class="article-categories">');
        for(x=0; x<categories.length;x++) {
            $('#articles-feed').append(
                    '<li class="article-category">' + categories[x] + '</li>'
                ); //end categories append data
                if (categories[x] == "free") {
                    $(".article-box").addClass("free");
                }
        }// end categories append for loop
        $("#articles-feed").append(
            '</ul><p>'+extract+'</p></div>'
            ); //end article feed 3rd append

    } //end article feed for loop

```