On my dataviz, both the input topojson and the svg polygons contains an attributes name:"..."
and data-name="..."
, respectively. In my D3js code I currently have :
function click(a){console.log(a.properties.name);}
which successfully print out the name's value.
In addition to this, how could I add a **double click to open a new tab with the url "http://en.wikipedia.org/wiki/"+a.properties.name
?**
Edit: Doubleclick is likely to be on("dblclick", function(){...})
, but you may think to other ways. I also prefer to build the url from the properties.name rather than store it into the SVG, which will make it uselessly heavier.