This Lesson is for subscribers

Takeaways:
- D3 selections allow you to modify DOM elements with the .attr operator
- Every DOM element in the selection gets modified whether the D3 selection contains 1 or more elements
- The D3 .attr operator works as a getter and setter
- For it to work as a setter, you pass in an attribute you want to define and the value you want to set it to
- You can set the value as a constant you pass in or you can have a function (named or anonymous) evaluated for each element in the selection
- For it to work as a getter, you pass in an attribute whose value you want and you do not pass in a value
- If the attribute exists, then you get the value
- If the attribute does not exist, then you get a "null"
- Using the D3 .attr as a setter, if you pass in a "null" as the value, then it deletes the attribute value pair from all of the elements in the selection
Resources: