title: Loop through paths D3 with .each
body: <p>I'm trying to make my first map in D3. The map is showing fine, but I now want to loop through each path I appended to my SVG. This is the code I'm working on:</p>
  
  <pre><code> var path = d3.geo.path()
                    .projection(projection);
   //Create SVG element
   var svg = d3.select("body")
               .append("svg")
               .attr("width", w)
               .attr("height", h);
  
  
   //Load in GeoJSON data
   d3.json("/data/friesland.json", function (json) {
  
       //Bind data and create one path per GeoJSON feature
          svg.selectAll("path")
          .data(json.features)
          .enter()
          .append("path")
          .attr("d", path)
          .attr('fill', 'rgba(29,91,85,1)')
          .attr('stroke', 'white')
          .attr('stroke-width', 1);
  
   });
  
   svg.selectAll('path').each(function (d, i) { console.log('test'); });
  </code></pre>
  
  <p>It seems that there are no paths binded to the svg, how can I change this?
  Thank you!</p>