I am on the Data Visualization with D3: Add Classes with D3 problem and I am trying to figure out why the terminal is having issues with my code, I am not getting any error message. I am using the code .attr(“bar”, “div”);
to put a class of bar on the div elements, am I missing something here?
I will admit the instructions are a tad bit confusing. Read this part again.
Here’s an example to add a class of “container” to a selection:
selection.attr("class", "container");
You already have the element so you can just dot (.
) on to it (in the chain) and add the class.
.attr("class", "someClassName")
Docs selection_attr