I'm using Snap.svg API and I have three graphics that I need to select in my CSS for styling purposes. Thus, to distinguish between them, I need to give them an ID or class name.
This is how I create an element:
var draw = Snap(100, 75);
c = draw.polyline(0,0, 50,75, 100,0, 0,0);
c.attr({
fill: "black"
});
This is the result I get:
<svg height="75" version="1.1" width="100" xmlns="http://www.w3.org/2000/svg">
<polyline points="0,0,50,75,100,0,0,0" style="" fill="#000000"></polyline>
</svg>
This is what I need the result to be:
<svg id="graphic_1" height="75" version="1.1" width="100" xmlns="http://www.w3.org/2000/svg">
<polyline points="0,0,50,75,100,0,0,0" style="" fill="#000000"></polyline>
</svg>