I am using the .on(‘click’, change); to call a function called change.
But I don’t know how to extract the svg element that was clicked.
Only the pointerEvent (event) and .data (which I’m not using) is parsed.
I can look at the event.target and see the rect object element when I console log it, but I can’t access the ‘id’ in it.
Possible solutions:
I would like, is to be able to parse a variable to the function (i variable to show which was clicked).
I would like to extract the ID from the eventpoint.target.
Or, used .data([0,1,2,3,4]) when constructing the svg, because my function would also gets the d was well as the event parsed.