Looking to iterate through all rect nodes in the code snippet below:
d3.selectAll("svg g rect")
.on('mouseover', function (d) {
console.log(this);
});
When Console.log is executed, the following is printed:
<rect class="cls" name="UK" style="fill: #fdb462;" transform="translate(52 50)" x="805.625" y="0" width="13.75" height="229.018" >...</rect>
To access the value of the "name" attribute (which is "UK") of the rect tag, attempting this.name
has not been successful. How can this be achieved?