Uncaught TypeError: Cannot read property 'parentNode' of undefined
<p>I am trying to convert google chart into an image.</p>

<p>I found this code on jsfiddle - <a href="http://jsfiddle.net/SCjm8/32/" rel="nofollow">http://jsfiddle.net/SCjm8/32/</a>. I want to download the image without pressing the button. Anything i try im always getting <code>Uncaught TypeError: Cannot read property 'parentNode' of undefined</code> error. </p>

<p>I tried making something like this for example (#test is id of the 'download image' button):</p>

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

<p>OR:</p>

<pre><code>  &lt;body onload="toImg(document.getElementById('pie_div'));"&gt;
</code></pre>

<p>But always getting the same error..
Any suggestions how can i make it so it would download the image without pressing the button? How can i fix this error?</p>
