tierrarara tierrarara - 1 year ago 51
Javascript Question

How to use css selector on SVGjs

I try multiple javascript libraries to work with svg

now i play with svgjs.com

but i don't know how to use css selector like snapsvg

var result1 = Snap.select('#id_select');
var result2 = Snap.select('.class_selector');

what is the solution for svgjs ?

i can select childrens but i need make a loop to compare properties for every child :(

what is the shortcut fot get some element inner svg document?

thanks for your attention

Ian Ian
Answer Source

You would use the get() method as per doc for id, or use jquery if needing a class

var element = SVG.get('my_element')