score:1

You can use d3 Selection's .filter() option to select the second element based on it's bound data.

So if you bind a click listener to the first element, you can select all circle elements and filter on the data attribute 'ID'. In your case, you'll probably want to add a separate class or data attribute to distinguish the second group of circles from the first.

eg:

`var selected = canvas.selectAll("circle").filter(function(e) {
    return e.Username === d.Username;
})`

edited to include content from Gerardo's fiddle


Related Query

More Query from same tag