title: JS Error: Element is not attached to a Document
body: <p>Am trying to convert div to image using <a href="https://html2canvas.hertzen.com/" rel="nofollow noreferrer">html2canvas</a> lib , but am keep getting that error</p>
  <pre><code>html2canvas.min.js:20 Uncaught (in promise) Error: Element is not attached to a Document
  at html2canvas.min.js:20
  at html2canvas.min.js:20
  at Object.next (html2canvas.min.js:20)
  at html2canvas.min.js:20
  at new Promise (&lt;anonymous&gt;)
  at a (html2canvas.min.js:20)
  at Vs (html2canvas.min.js:20)
  at html2canvas.min.js:20
  at HTMLInputElement.&lt;anonymous&gt; (index4.html:18)
  at HTMLInputElement.dispatch (jquery-2.2.4.min.js:3)
  </code></pre>
  <p>I not understand what's wrong with my code , when i run the code on jsfiddle it not give me any error when i run it on my local system it give me error.</p>
  <p><strong>code</strong></p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src=&quot;https://code.jquery.com/jquery-2.2.4.min.js&quot; &gt;&lt;/script&gt;
  &lt;script src=&quot;https://html2canvas.hertzen.com/dist/html2canvas.min.js&quot;&gt;&lt;/script&gt; 
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id=&quot;phone&quot;&gt;45454565756677&lt;/div&gt;    
  
  &lt;div id=&quot;out_image&quot;&gt;&lt;/div&gt;
      
   &lt;input type=&quot;button&quot; value=&quot;Data to Image&quot; id=&quot;data_to_image_btn&quot; &gt;
    
    
    
  &lt;script&gt;
      
      $(function() { 
      $(&quot;#data_to_image_btn&quot;).click(function() { 
          html2canvas($(&quot;#phone&quot;), {  // no error with : document.getElementById( but nothing is rendered
              onrendered: function(canvas) {
                  console.log('done ... ');
                  $(&quot;#out_image&quot;).append(canvas);
              }
          });
      });
  }); 
  &lt;/script&gt;  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>