Unable to insert the value in html table cell
Dear All,
I am trying to insert the value through Jquery or Javascript in html table row[1][2] , But I am finding no luck
Can any one please help me what's wrong in my below lines
<!DOCTYPE html>
<html>
<head>
<style>
table, td {
border: 1px solid black;
}
</style>
</head>
<body>
<p>Click the button to insert new cell(s) at the beginning of the table row.</p>
<table id="total" style="width:100%">
<caption>Count Of Sessions</caption>
<tr>
<th>Sessions</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
<th>TBD</th>
<th>Total</th>
</tr>
<tr>
<td>Total Trainings</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Trainings Not Scheduled</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Sessions Cancelled</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table><br>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var row = document.getElementById("total");
var Cells = Row.getElementsByTagName("td");
Cells[1].innerHTML = "New cell";
}
</script>
</body>
</html>
Srk