The SVG Element.id property returns the id of the given element.
Syntax:
var idStr = element.id; // Get the id
Return value: This property returns the id of the element.
Example 1:
Output:
Example 2: