jQuery - Adding a link to html()
<p>I have a link inside of a div element. The link has a click listener.</p>

<pre><code>$(document).ready(function() {
    $('#theLink').click(function() {
        // do stuff
    });
})

&lt;div id="myElement"&gt;&lt;a class="myLink" id="theLink"&gt;Click here&lt;/a&gt;&lt;/div&gt;
</code></pre>

<p>At some point in my application, I have to clear the div elements contents, and then have to re-write them again later. When I rewrite the link using .html(''), I lose the click listener and the link doesn't work.</p>

<pre><code>$('#myElement').html(''); // clear element

$('#myElement').html('&lt;a class="myLink" id="theLink"&gt;Click here&lt;/a&gt;');
</code></pre>

<p>Do I need to add a new listener to get this link working again?</p>
