I have a button, when I press it, I must show a hidden column I have in my table. But my problem is that I only show one row.
<a href="#" class="btn-xl btn-default" id="btn_callkit" onclick="call();return false;" style="width: 150px;color: white;">KIT</a>
<table id="example0" class="table table-striped">
<br/>
<thead>
<tr>
<th id="kit_head" style="display:none;">KIT</th>
<th>Material</th>
<th>Info</th>
</tr>
</thead>
<?php
$rol = mysql_query("SELECT * from pg WHERE pg.dataset = 2 ");
if (mysql_num_rows($rol) != 0) {
while($item = mysql_fetch_array($rol)) {
$id = $item['id'];
$info = $item['info'];
$code = $item['lote_code'];
?>
<tr id="infodata_<?=$id;?>">
<td id="line" style="display:none;">
<div class="checkbox checkbox-circle" style="text-align:center;margin-top:40px;">
<input id="check_<?=$id;?>" type="checkbox">
<label for="check_<?=$id;?>">
</label>
</div>
</td>
<td><?php echo $info;?></td>
<td><?php echo $code;?></td>
</tr>
<? }} ?>
</tbody>
</table>
My Javascript has this code:
function call()
{
document.getElementById('kit_head').style.display = 'block';
document.getElementById('line').style.display = 'block';
}
What may I do it to show all of the rows that my database has inside?
classinstead of anid, e.g. use<th class="toggleColumn"anddocument.getElementByClass('toggleColumn')