I have a DOM structure that looks like this:
<div id="comment-1234" class="comment">...</div>
<div id="comment-2391" class="comment">...</div>
<div id="comment-1223" class="comment reply">...</div>
<div id="comment-1221" class="comment reply">...</div>
<div id="comment-2333" class="comment">...</div>
<div id="comment-1235" class="comment reply">...</div>
<div id="comment-3333" class="comment reply">...</div>
<div id="comment-5555" class="comment">...</div>
In my javascript, I’ll have the ID of the div that is getting a new reply, eg comment-2391. What I need to do is find that comments last reply, and insert a new div after that. The script is currently using append('#comment-1234') and that is working just fine, but it inserts it at the top of the replies.
Any ideas?
Try this:
where
newcommentis the new DIV that you want to insertDemo: http://jsfiddle.net/DaX94/