I have to add a World Map Svg into Html using only Javascript and make it interactive. With the 'mouseenter' on a country the SVG display the name of the country.
I started creating Html tag object in which i linked my SVG.
WorldMap.prototype.renderWorldMap = function() { var elBody = document.querySelector('body'); var elObj = document.createElement('object'); elObj.data = "World_map.svg"; elObj.style.width = '100vw'; elObj.style.height = '100vh'; elObj.id = 'svg'; elBody.appendChild(elObj); }; The World Map SVG is displaying but now i have issues accessing the id of every path of the SVG. So i was wondering if the method to add the SVG in the HTML was correct.
Here is the link for the SVG : https://upload.wikimedia.org/wikipedia/commons/8/80/World_map_-_low_resolution.svg
Thank you for helping :)