@adan
To create a (description list) element using d3.js, you can use the following code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// Data for the description list var data = [ { term: "Term 1", description: "Description 1" }, { term: "Term 2", description: "Description 2" }, { term: "Term 3", description: "Description 3" } ]; // Select the <dl> element var dl = d3.select("body").append("dl"); // Create <dt> and <dd> elements for each data item var dt = dl.selectAll("dt") .data(data) .enter().append("dt") .text(function(d) { return d.term; }); var dd = dl.selectAll("dd") .data(data) .enter().append("dd") .text(function(d) { return d.description; }); |
In this code:
This code will create a element with and elements for each data item in the data array.