handling if an element doesnt exist?

handling if an element doesnt exist?

  1. var d = $(document.createElement('div'));
  2.                                         
  3. d.html($("#blog_reply_template_holder").html());
  4. $('.blog_comment_reply_holder:first').before(d);

Above is a cut down version of my code.

I am dynamically adding blog comments to the dom.

This works fine when I have comments on the page already, but when this is the first comment I have a problem as there is no :
.blog_comment_reply_holder:first

What would be a better way to handle this to ensure that my new div still gets added to the page?