Error : "Uncaught Typeerror: cannot read property 'innerHTML' of null" when appending a new <script> to div
<p>In below fiddle I am receiving this error : 
Uncaught TypeError: Cannot set property 'innerHTML' of null </p>

<p>Looking at the code it the error seems to be thrown here : </p>

<pre><code>_$("pds-answer6343621").innerHTML=y6343621
</code></pre>

<p>I think this is occuring because the script is executing before the document is parsed but since the function is being called within $(document).ready it should work ?</p>

<p>How can fiddle be modified so that script is loaded when function update() is invoked
<a href="http://jsfiddle.net/m7q3H/121/" rel="nofollow">http://jsfiddle.net/m7q3H/121/</a></p>

<p>Fiddle code : </p>

<pre><code>   &lt;body&gt;
    &lt;div id="toupdate"&gt;
     &lt;div id="toremove"&gt;
&lt;script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/5968383.js"&gt;&lt;/script&gt;
&lt;noscript&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/body&gt;​

$(document).ready(function() {
update();
                     });

    function update(){
            $('#toremove').remove();
        alert('removed');
$('#toupdate').append('&lt;div id="toupdate"&gt;&lt;script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/6343621.js"&gt;&lt;/scr'+'ipt&gt;&lt;/div&gt;');

    }

​
</code></pre>
