jQuery.html() - The JavaScript code is executed but disappears
<p>I am developing a small editor to add widgets (HTML, CSS and Javascript) to a site.</p>

<ul>
<li>The user types into a field the widget code.</li>
<li>When validating, the code of the widget is added to the page.</li>
<li>The user can edit the code (which is retrieved from the DOM).</li>
</ul>

<p>Except that I have a problem to retrieve the javascript code. Indeed, it is well executed, but disappears from the DOM. There is something that escapes me!</p>

<p>I simplified my problem here:
HTML code:</p>

<pre><code>&lt;textarea id="code"&gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;alert(&amp;quot;code&amp;quot;);&amp;lt;/script&amp;gt;
&lt;/textarea&gt;
&lt;div id="target"&gt;&lt;/div&gt;
</code></pre>

<p>Javascript code:</p>

<pre><code>$("#target").html($("#code").val());
alert($("#target").html());
</code></pre>

<p>Try it out : <a href="http://jsfiddle.net/8uhB8/3/" rel="nofollow">http://jsfiddle.net/8uhB8/3/</a> <code></code></p>

<p>This example insert javascript code (a simple javascript alert) and tries to retrieve it.</p>

<p>Do you have any idea?</p>

<p>Thanks!</p>
