jQuery does not trigger live event if the element was removed from DOM
<p>I tried to move from jQuery 1.6.3 to 1.7.2 and stuck with a problem I can't resolve. Here is the code to be clear.</p>

<p>Assume you have the following on the page</p>

<pre><code>&lt;div id="main"&gt;
    &lt;div id="child"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>you should see 2 alerts, works in jQuery 1.6.3 but does not in 1.7.2</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(function() {
        $("#child").live("my-event", function() { alert(1);});
        var child = $("#child");
        child.trigger("my-event");
        $("#main").html("&lt;div id='child'&gt;&lt;/div&gt;");
        child.trigger("my-event");
    });
&lt;/script&gt;
</code></pre>

<p>The first one to blame is the deprecated live() method, but it is not the case. var child does not trigger live event, $("#child") works perfectly, but it is absolutely necessary to trigger event with var not selector. Any help is appreciated.</p>
