This is my solution and I think this is the best way I can use .insertAfter()
:
HTML:
jquery:
$('#b').on('click',function(){
$('.myUniqueElement').insertAfter($('.p :last-child'))
});
The point is :last-child
and this is the fiddle:
http://jsfiddle.net/silverlight/RmB5K/3/