2018-10-12 19:37:13 +00:00
|
|
|
---
|
|
|
|
title: Select a Group of Elements with D3
|
|
|
|
---
|
|
|
|
## Select a Group of Elements with D3
|
|
|
|
|
2018-10-17 04:10:23 +00:00
|
|
|
### Hint
|
2018-10-12 19:37:13 +00:00
|
|
|
|
2018-10-17 04:10:23 +00:00
|
|
|
Use the ``` selectAll() ``` method and chain it with the ``` text() ``` method.
|
2018-10-12 19:37:13 +00:00
|
|
|
|
2018-10-17 04:10:23 +00:00
|
|
|
### Solution
|
|
|
|
|
|
|
|
```html
|
|
|
|
<body>
|
|
|
|
<ul>
|
|
|
|
<li>Example</li>
|
|
|
|
<li>Example</li>
|
|
|
|
<li>Example</li>
|
|
|
|
</ul>
|
|
|
|
<script>
|
|
|
|
d3.selectAll("li").text("list item")
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
```
|