I have some SVG images on my html page. I want get id of each image by click on it. HTML:
<div class = "svgLoading"><object data="images/91.svg" type="image/svg+xml" id = "47"></object></div>
<div class = "svgPoints"><object data="images/30.svg" type="image/svg+xml" id = "48"></object></div>
I'm trying to get them like this:
document.body.onclick = function(event) {
var target = event.target || event.srcElement;
alert(target.tagName); }
Its working fine for other elements, for example: img, div without object. But clicking on the svg is ignored. Why is this happening and how to properly handle clicks on svg?