Appended HTML that contains javascript doesn't run, how can I make it run?
<p>I'm appending some HTML containing javascript.</p>

<pre><code>&lt;td onclick="toggleDay('+data+',this,\'tue\');"&gt;T&lt;/td&gt;
</code></pre>

<p>and</p>

<pre><code>&lt;img src="img/cross.png" onclick="deleteAlarm('+data+');"&gt;
</code></pre>

<p>These two pieces of code are in the big amount of HTML I'm appending.</p>

<p>They work fine if they are already there when the page loads but not when I'm appending.</p>

<p>What do you suggest me to do? Is it needed some sort request for the DOM to re-interpret the JavaScript after the append or?</p>

<p>EDIT:</p>

<p>Just some more info, I'm with this problem, because I'm adding some stuff with AJAX to the database, and on success I'm appending the html to where it needs to be. Kinda the same way SO does with the comments. </p>

<p>Edit2:</p>

<p>Even with all the discussion about it, thanks for the answers, got it working.</p>
