问题
I am trying to get svg representation of a div.I am using jQuery SVG for this http://keith-wood.name/svg.html
I am doing this on page load:
var pad = null;
$('.MyDiv').svg({onLoad: function(svg) {
pad = svg;
}
});
and on every change inside div , i am doing this:
var svg = $('.MyDiv').svg('get');
alert(svg.text);
but i am getting some JS code in alert.
i tried alerting svg.toSVG()
but i am getting this :
<svg version='1.1'></svg>
in alert
svg.toSVG()
seems to work but i am getting empty svg doc even if my div has data in it.
what i am doing wrong here?
回答1:
The innerSVG shim might be helpful to you.
来源:https://stackoverflow.com/questions/11340476/get-svg-representation-of-div-using-jquery-svg