ledowaisedo
New Member
I want to show the delete button below the table if any of the row checkboxes are checked. Otherwise, the button should stay hidden.Table I want it to be implemented.screenshot of table:
This is the html table code behind.\[code\] <table id="datatable_example" class="responsive table table-striped table-bordered" style="width:100%;margin-bottom:0; "> <thead> <tr> <th style="width:0px; padding-right:0px;" class="jv no_sort"> <label class="checkbox "> <input type="checkbox"> </label> </th> <th style="width:200px;" class=""> Skill </th> <th style="width:300px;" class="to_hide_phone no_sort"> Description </th> <th class=""> Rating </th> <th style="width:200px;" class="ue no_sort"> Date </th> <th class="ms no_sort "> Actions </th> </tr> </thead> <tbody> <?php echo $skills; ?> </tbody> </table>\[/code\]This is the skills variable:\[code\]$skills="";while($row=mysql_fetch_array($skills_list)){ $showskillid=$row['skill_id']; $showskillname=$row['skill_name']; $showskilldescription=$row['skill_desc']; $showskillrating=$row['skill_rating']; $showskill_lastupdated=$row['last_updated']; $skills .="<tr> <td><label class=\"checkbox\"> <input type=\"checkbox\" class=\"chkboxes\" name=\"ids[]\"> </label></td> <td class=\"to_hide_phone\"> $showskillname </td> <td class=\"to_hide_phone\">$showskilldescription</td> <td> $showskillrating </td> <td> $showskill_lastupdated </td> <td class=\"ms\"><div class=\"btn-group1\"> <a href=http://stackoverflow.com/"skill_edit.php?id=$showskillid\" class=\"btn btn-small\" rel=\"tooltip\" data-placement=\"left\" data-original-title=\" edit \"><i class=\"gicon-edit\"></i></a> <a class=\"btn btn-small\" rel=\"tooltip\" data-placement=\"top\" data-original-title=\"View\"><i class=\"gicon-eye-open\"></i></a> <a class=\"btn btn-small\" rel=\"tooltip\" data-placement=\"bottom\" data-original-title=\"Remove\"><i class=\"gicon-remove \"></i></a> </div></td> </tr>";}\[/code\]The Jquery which I tried but I know I am newbie in jquery so need help to fix it.\[code\] <script type="text/javascript">$(document).ready(function() { $('.delbtn').hide(); });$('.chkboxes').click(function(){ $('.delbtn').toggle();});</script>\[/code\]Jquery I tried it somehow works like when I click one checkbox the button shows up and when I go and click the other checkbox the button disappears?I know toggle should not be used here..What instead should I use here to fix this issue, or if there is more better option to fix it I am open to it..