From 5bc241a9a7f8a72f3da1ed37c86a6264d8331fc7 Mon Sep 17 00:00:00 2001 From: The Coding Aviator <34807532+thecodingaviator@users.noreply.github.com> Date: Tue, 16 Oct 2018 20:35:22 +0530 Subject: [PATCH] Update add-classes-with-d3.english.md (#19508) * Update add-classes-with-d3.english.md * Update add-classes-with-d3.english.md * Update add-classes-with-d3.english.md --- .../data-visualization-with-d3/add-classes-with-d3.english.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.english.md b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.english.md index 52fc020e66..5913e4f3e8 100644 --- a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.english.md +++ b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-classes-with-d3.english.md @@ -11,6 +11,8 @@ challengeType: 6 Using a lot of inline styles on HTML elements gets hard to manage, even for smaller apps. It's easier to add a class to elements and style that class one time using CSS rules. D3 has the attr() method to add any HTML attribute to an element, including a class name. The attr() method works the same way that style() does. It takes comma-separated values, and can use a callback function. Here's an example to add a class of "container" to a selection: selection.attr("class", "container"); + +Note that the "class" parameter will remain the same whenever you need to add a class and only the "container" parameter will change. ## Instructions @@ -73,6 +75,6 @@ tests:
```js -// solution required +.attr("class","bar"); ```