-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathd3_simple_append.html
More file actions
executable file
·47 lines (34 loc) · 1.01 KB
/
d3_simple_append.html
File metadata and controls
executable file
·47 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<!-- File from Scott Murray's Knight D3 course -->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Creating HTML Elements</title>
<!--This will error unless you have d3 local in the course files js dir.
And it won't work on a bl.ocks.org page if you refer to a local file. -->
<script type="text/javascript" src="../js/d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
d3.select("body")
.append("p")
.text("This is my first paragraph!");
d3.select("body")
.append("p")
.text("This is my second paragraph!");
d3.select("body")
.append("p")
.text("This is my third paragraph!");
//Store the selection in a variable,
//so we can easily reference it later
var body = d3.select("body");
//Reference that selection
body.append("p")
.text("This is my fourth paragraph!");
body.append("p")
.text("This is my fifth paragraph!");
body.append("p")
.text("This is my sixth paragraph!");
</script>
</body>
</html>