Q:

any tagged element within a div is closing it

I have attached: http://jsfiddle.net/75JaR/12/
What this is supposed to do is each link should open a div which is closeable by clicking outside the div. This works great thanks to some help here on stackoverflow.
However if I put anything in that div other than straight text it, clicking on it will close it.
I cannot  wrap text in p, a, span or even use an image, could anyone tell me why this might be?
EDIT: if you try clicking on the tagged text it will close
      $('.trigger').click(function (e) {
    e.stopPropagation();
    $('.header-menu-container').hide();
    $(this).next('.header-menu-container').slideDown();
});

$(document).click(function (e) {
    var $this = $(e.target);
    if ($this.hasClass("header-menu-container")) return;
    if ($this.hasClass("header-menu-contents")) return;
    $('.header-menu-container').slideUp();
});

A:

You need to check if the element parent div has not the class
 if ($this.hasClass("header-menu-container")) return;
if ($this.hasClass("header-menu-contents")) return;

If you click the <p><p>
The <p> has not the class and that's why it is closing 
Check this fiddle
fiddle

