I use the Snap.svg API, and I have three graphics that I need to select in my CSS for styling. So in order to distinguish between them, I need to give them an identifier 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:
<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>
Here is what I need for the result:
<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>
João Belo
source share