I'm using the library SVG.js and svg.select.js to manipulate svg objects, I have problems selecting text elements as you can see in this example. With the ellipse there are no problems while this is the error message when trying to select the text: "Uncaught TypeError: this.parent.group is not a function" This is my code:
var draw = SVG('drawing')
var selectedelement;
var g = draw.group();
text = g.text('Perepepeeeee');
var myEllipse = g.ellipse(50, 50);
myEllipse.move(200, 0);
g.on("click", function (event) {
if (selectedelement!=null)
selectedelement.selectize(false, { deepSelect: true });
selectedelement=SVG.get(event.target.id).selectize({ deepSelect: true })
});
Where am I wrong?
event.target.id. Does your group has an id? Because you never set one. Beside that you would select the group and not the text inside.SVG.getthe element in the handler. Because thethiscontext in the handler is bound to the group. No need to get fancy