i have this table and it has a button on its right most column and i wanted that when i click that button, p tags will change according to the values on the row where the button is as of now here is how my table looks like
and my code
<table class="table table-striped table-hover" id="detailTable">
<thead>
<tr>
<th>Record ID</th>
<th>School Year</th>
<th>School Quarter</th>
<th>Student Name</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>123</td>
<td>SY 2013-2014</td>
<td>2nd Quarter</td>
<td>Billy Joel</td>
<td><button class="btn" onclick="tgPanel();">Edit</button></td>
</tr>
//more rows here
</tbody>
and here is my javascript code
function tgPanel()
{
document.getElementById("rid").innerHTML = document.getElementById("detailTable").rows[0].cells[1].getVal;
document.getElementById("sy").innerHTML = document.getElementById("detailTable").rows[0].cells[2].getVal;
..and so on..
}