what's the difference between selection.style and selection.attr in D3.js?

Viewed 8794

I found both of them works in my test:

    .on("mouseover",
        function() {
            d3.select(this)
                .select("text")
                .style("fill","red");
        })

or

    .on("mouseover",
        function() {
            d3.select(this)
                .select("text")
                .attr("fill","red");
        })
2 Answers
Related