I got this SVG image from Wikipedia and embedded it into a website using this code:
<embed src="circle1.svg" type="image/svg+xml"/>
If you run this, you can inspect the element and see the source code. All countries in the image are separate elements. If I click on a country, I want to alert the id of that country, since every country has an id of two letters in the SVG. Does anyone know a way to do this? Would it be easier if I place it into a element?
Okay using your comments I found an answer to my problem. I added this code in the svg itself.
The function addClickEvents is triggered when the svg loads.
But I still have another problem with this. I have to embed this svg (with the code) into a HTML document using
Instead of alerting the id, I have to place it into a div in the HTML document.
How do I get this id from the svg?