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 : /
alert box will show only in chrome but not in IE..
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/r8v70Lnk/
alert box will show only in chrome but not in IE..
Share Improve this question edited Feb 9, 2019 at 1:07 Splaktar 5,9045 gold badges45 silver badges75 bronze badges asked Apr 27, 2015 at 5:45 Akbar BashaAkbar Basha 1,1981 gold badge17 silver badges40 bronze badges 7- 6 Possibly related stackoverflow./questions/12592417/… – Miguel Commented Apr 27, 2015 at 5:45
-
maybe you don't need
$(this)[0]
? – filype Commented Apr 27, 2015 at 5:48 - What do you mean by "not working"? – Maurice Perry Commented Apr 27, 2015 at 5:48
- the exact path can be log (console) in chrome but same sample in IE it can be logged as undefined – Akbar Basha Commented Apr 27, 2015 at 5:51
- @Filype is right, btw: $(this)[0].outerHTML === this.outerHTML – Maurice Perry Commented Apr 27, 2015 at 5:52
1 Answer
Reset to default 9Dont 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")