SO 38823238
by Dig
HTML
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<div class="form-group">
<div class="col-md-2">
<input type="checkbox" name="chkchange" id="chkchange" value="0"> Change All Countries
</div>
<div class="col-md-2">
<input type="button" id="btn1" name="btn1" value="Row1"/>
<input type="button" id="btn2" name="btn2" value="Row 2"/>
</div>
</div>
<table class="table table-striped" id="tablecountry">
<thead>
<tr>
<th>Country</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
</thead>
<tbody>
<tr class="row2">
<td>Content</td>
</tr>
<tr type="hidden" id="rowhidden" class="rowhidden">
<td>Hello</td>
</tr>
</tbody>
</table>
JavaScript
$("#chkchange").change(function() {
$("#tablecountry tr.row2").toggle(!this.checked);
$("#tablecountry tr.rowhidden").toggle(this.checked);
});
//$("#chkchange").change();
$("#tablecountry tr.rowhidden").hide();
$('#btn1').click(function(){
$("#tablecountry tr.row2").show();
$("#tablecountry tr.rowhidden").hide();
});
$('#btn2').click(function(){
$("#tablecountry tr.row2").hide();
$("#tablecountry tr.rowhidden").show();
});