-1

I'm trying to make a event listener, as detailed here. For this, I'm analyzing the this construct. When adding a point in the given link, and adding the line

  console.log(this);

in the handleMouseOver event handler, this yields the element (for example)

  <circle cx="231 cy="333" r="6" fill="black"></circle>

I now wish to select one of these attributes in order to control the behaviour. How could I select (for example), the cx attribute? I've tried

this.attr('cx')

without no success. Thanks for all input!

albttx
  • 3,444
  • 4
  • 23
  • 42
Gabriel
  • 121
  • 4

1 Answers1

4

this is simple Dom node. You can use:

this.getAttribute( 'cx' );

or

d3.select( this ).attr( 'cx' );
Arnial
  • 1,433
  • 1
  • 11
  • 10