title: D3.JS: How to get nodes of corresponding link (edge)
body: <p>I've just started using D3 for my webapplication to visualize a graph. My edges and nodes are clickable. The nodes send the user to a table containing information about the node when doubleclicked. I would like to do the same with the edges so when clicked. I would like to retrieve the corresponding nodes to that edge,so that i could send that information to another script. </p>
  
  <p>So technically what i would like to know is how to retrieve the name of the nodes corresponding to the edge. E.g. node A is connected to node B. How do i retrieve that node information when clicked on the edge (link)? The output should be the values A and B. I've looked through everything and i'm not able to find any information on this.</p>
  
  <p>My edges and node information is in a JSON file </p>
  
  <pre><code>d3.dataset = {
      "nodes":[
          {"name":"heart problems","group":"1"},
          {"name":"acetic acid","group":"3"},
          {"name":"alzheimers","group":"1"},
          {"name":"bipolar","group":"1"},
          {"name":"ebola","group":"1"},
          {"name":"vaccinium myrtillus","group":"2"},
          {"name":"adamantane","group":"3"},
          {"name":"fluorene","group":"3"}
      ],
      "links":[
          {"source":3,"target":1,"value":20},
          {"source":3,"target":6,"value":20},
          {"source":3,"target":7,"value":9},
          {"source":0,"target":1,"value":19},
          {"source":0,"target":6,"value":1},
          {"source":2,"target":1,"value":20},
          {"source":2,"target":6,"value":20},
          {"source":2,"target":7,"value":5},
          {"source":4,"target":1,"value":2},
          {"source":4,"target":6,"value":3},
          {"source":2,"target":5,"value":2},
          {"source":5,"target":1,"value":2}
      ]
  }
  </code></pre>
  
  <p>SOLUTION, thank you for the answer i feel so stupid... i forgot to use the d in the function :)</p>
  
  <p>This is the function now, the clickonEdgeEvent function passes the values on to my HTML</p>
  
  <pre><code>var clickOnEdge =  svg.selectAll(".link").on("dblclick", function(d){
  d3.select(this).attr('r', 8)
  .style("fill","lightcoral")
  .style("stroke","red")
  clickonEdgeEvent((d.source.name),(d.target.name));
  });
  </code></pre>
  
  <p>Thanks in advance for your help,
  Dani</p>