title: Accessing d3.js element attributes from the datum?
body: <p>I'm trying to access the cx &amp; cy attributes of some specific svg circles which i have already drawn to the screen using d3.js's .data() function, can anyone help out? The code that's trying to access it is below.</p>
  
  <pre><code>d3.selectAll(".mynode").each( function(d, i){
    if(d.someId == targetId){
      console.log( d.attr("cx") );    // just trying to demo my point, doesn't work
    }
  }
  </code></pre>
  
  <p>I'm quite new to d3.js &amp; javascript, so i'm not sure if i'm approaching this back to front anyways or perhaps i may have missed an inbuilt solution?</p>