Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy .html() doesn't work with SVG selectors using jquery ?
    primarykey
    data
    text
    <p><strong>Question</strong> can some one tell me how can i convert my SVG element to a string ?</p> <p>i'm using <a href="http://code.google.com/p/canvg/" rel="nofollow noreferrer">canvg</a> to convert my SVG to an image.</p> <p>it has to be render in a canvas first , the <code>canvg()</code> method is expecting a <code>SVG STRING</code></p> <p>code : </p> <pre><code> function updateChartImage(){ canvg(document.getElementById('canvas'),expecting ` svg string`); var canvas = document.getElementById("canvas") ; var img = canvas.toDataURL("image/png"); img = img.replace('data:image/png;base64,', ''); $("#hfChartImg").val(img) ; $('#img').attr({ src: img }); } </code></pre> <p>i have tried </p> <pre><code>$('#container svg').html() ; // it gives me an error //Uncaught TypeError: Cannot call method 'replace' of undefined </code></pre> <p><em>notice that</em></p> <pre><code> $('#container svg') $('#container').html() // both works fine and </code></pre> <p><strong>UpDATE</strong> </p> <p>i'm using highcharts the have a getSVG() function that i can pass to the canvg() but the problem is it dosen't get the latest updates , so i have to do it this way , when running the <code>getSVG()</code> function i get the following : <img src="https://i.stack.imgur.com/gCgr7.png" alt="enter image description here"></p> <p><a href="http://content.screencast.com/users/minagabriel/folders/Jing/media/ae01e002-0a91-4fa3-a7d0-801eece412e9/2012-07-09_0959.png" rel="nofollow noreferrer">LINK</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload