append() triggers on('click')
<p>I am trying to prevent an on click event from firing and I have done just about everything I can think of. What is happening is you click on a submit button which then does a bit of validation and if fails I present a tooltip for the reason. To show the tool tip I enter <code>$element.append($tooltip)</code> which then triggers <code>$(body).on('click', function() {})</code></p>

<p>I have verified that if I remove the append the click is not triggered.</p>

<p>Does anyone know why an append it triggering the click event?</p>

<p>Here is more code. This is the actual ToolTip code:</p>

<pre><code>//Sets up a tooltip to display feedback
//position: top, bottom or right
NG.Tooltip = function (target, message, timeout, position, doAdjust) {
    var tt = (this == NG ? {} : this); //Prevent people from accidentally missing the "new" keyword and corrupting the global NG object
    var $target = $(target);
    var $targetParent = $target.parent();
    var $offsetParent = $target.offsetParent();
    tt.targetElement = $target.get(0);
    if(!tt.targetElement){
        return;
    }

    //Remove previous tooltip if there is one already attached to target element
    if (tt.targetElement.ngTooltip)
        tt.targetElement.ngTooltip.Remove();

    if (!timeout) timeout = 2000;

    var $div = tt.div = $('&lt;div class="ngTooltip"&gt;' + message + '&lt;/div&gt;');
    var pos = $target.position();
    var posParent = $targetParent.position();
    if (position == 'bottom') {
        $div.css({ "left": (pos.left) + "px", "top": (pos.top + $target.outerHeight() + 10) + "px" });
    }
    else if (position == 'top') {
        $div.css({ "left": (pos.left) + "px", "top": (pos.top) + "px" });
    }
    else if (position == 'parent-bottom-left') {
        $div.css({ "left": (posParent.left) + "px", "top": (pos.top + $target.outerHeight() + 10) + "px" });
    }
    else {
        $div.css({ "left": (pos.left + $target.outerWidth() + 10) + "px", "top": pos.top + "px" });
    }

    // commenting out this allows the code to go without triggering the click
    //$offsetParent.append($div);

    if (position == 'parent-bottom-left') {
        if ((posParent.left + $div.width()) &gt; $offsetParent.width()) {
            $div.css("width", ($offsetParent.width() - (posParent.left + 15)) + "px");
        }
    }

    //Default to adjust it onscreen.
    //But there are certain cases such as popping up the url of a (link) on hover where adjusting it would not work out well
    if (doAdjust == null || doAdjust == true) {
        NG.AdjustPopupOnScreen($div);
    }

    tt.Remove = function (elem) {
        if (tt.timeoutId)
            window.clearTimeout(tt.timeoutId);
        $div.unbind('click'); //removes click event attached
        $div.remove();
        tt.targetElement.ngTooltip = null;
    };

    $div.click(tt.Remove);
    tt.timeoutId = null;
    if (timeout &gt; 0)
        tt.timeoutId = window.setTimeout(function () { tt.Remove(); }, timeout);

    tt.targetElement.ngTooltip = this;
    return this;
};
</code></pre>
