8

Here is my code

<svg id="a" height="210" width="400">
  <path id="b" d="M150 0 L75 200 L225 200 Z" />
</svg>

i have trigger mouse move event on b

   $("#b").hover(function() {
        alert($(this)[0].outerHTML);
    });

this was working in chrome but not working in IE how can i solve this..

please find the JSFiddle link : http://jsfiddle.net/r8v70Lnk/

alert box will show only in chrome but not in IE..

Splaktar
  • 5,506
  • 5
  • 43
  • 74
Akbar Basha
  • 1,168
  • 1
  • 16
  • 38

1 Answers1

9

Dont know if it is a solution for you but i usually do it like:

new XMLSerializer().serializeToString(document.querySelector('#b'))

If you want to parse the string again and insert the node in your document:

new DOMParser().parseFromString(svgString, "image/svg+xml")
Philipp Wrann
  • 1,751
  • 3
  • 19
  • 29
  • Evergreen browsers work with the outerHTML spec for SVGs, just not IE and company. This solution works great though. Thanks! – Modular Oct 04 '17 at 16:06