How Get Svg Code From Html Page, Using Jquery Or Javascript? January 30, 2024 Post a Comment I have simple HTML page with svg like this: Solution 1: To combine the previous answers (which were not clear for me at first) the way to get the SVG string is following:var str = $('<div>').append($('#plan #rect1').clone()).html(); CopySolution 2: $('#rect1')[0] CopyThis should help. If you want to access tag instead of jQuery element, use [] to get encapsulated element.Edit :This should do the trick for you.The solution explained is to wrap your selection into another tag and call .html() on it to display its content.Don't forget the .clone() call before appending it into your temp div, otherwise you will have some trouble in your html :) Share Post a Comment for "How Get Svg Code From Html Page, Using Jquery Or Javascript?"
Post a Comment for "How Get Svg Code From Html Page, Using Jquery Or Javascript?"