i.one i.one - 1 year ago 149
jQuery Question

show/hide button javascript by status

i have code like this

var a="<?php echo $data[0]->status;?>";
else if(a=2)


<table id="cell1" class="table table-striped table-bordered table-hover">
<th> NO </th>
<th> Name</th>
<th> Status </th>
<tbody >
<?php $no=1; ?>
<?php foreach($data as $row):?>
<td> <?php echo $no++;?> </td>
<td> <?php echo $row->name;?> </td>
<td> <?php echo $row->status;?></td>
<td><a href='' type="button" class="btn btn-circle blue btn-sm">View 1</a>
<a href='' type="button" name="view2" class="btn btn-circle blue btn-sm">View 2</a></td>
<?php endforeach;?>

when status=1,button view 2 is hidden and vice versa.i have tried but actually all button hidden.
how to resolve it?

Answer Source

please update your code a little bit to

if(Number(a) === 1) {
else if(Number(a) === 2) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download