V Posted June 29, 2010 Share Posted June 29, 2010 So I finally finished a comment system but it seems when everything looks perfect another issue arises When you post a new comment, it loads it via Ajax without loading the page. And the newest comment appear first on top to li:first. All comments are wrapped in ul. This is part of the code that does that ..... $.ajax({ type: "POST", url: "insert_comment.php", data: dataString, cache: false, success: function(html){ $("ul.comments li:first").before(html); $("ul.comments li:empty").append(html); } }); }return false; .... The issue is, the very first comment in the post doesn't appear unless you refresh. It does however when I remove the li:first and li:empty and for example just use $("ul.statuses").append(html); but then the comment won't appear on top as I want to. The comments following the first appear like I want to.. I just can;t figure out why the first does that Link to comment https://forums.phpfreaks.com/topic/206184-append-to-lifirst-child/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.