Looking to insert text into a cell using d3?
I have a function with the necessary code, which I am calling in the body of an HTML page. Here is a sample of the code that I am trying to get working:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href ="styles.css">
<script type="text/javascript" src="http://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript">
function updateCell(){
d3.select("td#target").text("14");
}
</script>
</head>
<body onload="updateCell()">
<table>
<tr>
<th>Name</th>
<th>Surname</th>
<th>Age</th>
</tr>
<tr>
<td>Tom</td>
<td>Smith</td>
<td id="target"> </td>
</tr>
</table>
</body>
</html>
Let me know if you have any suggestions on how to make this work.