I have a SVG canvas and when I double-click on it, I create a new SVG element inside it.
How I do to create a click event for these new elements created at real time by the id of the new element.
These elements ids will be a word I inform.
The elements are created by an external API (Graph Dracula), so can’t change it.
Example: I add a new element called “Renato”, so the element id will be “Renato”.
It sounds like you should just be able to bind it using something like:
$(“#…”).click(function() { … });
Basically it’s like normal. You just need some kind of reference to it and you can use jQuery to bind something on it. If you’re creating it, you obviously have a reference to it then, so you could do it at that step.
Edit: just read that they’re created by an external API. However, if you know the id, you can always just use $(“#idhere”).