Some checkboxes in jsp::
<input type="checkbox" checked="checked" id="DevId" name="Dev1">Dev
<input type="checkbox" checked="checked" id="CitId" name="Cit1">CIT
<input type="checkbox" checked="checked" id="SitId" name="Sit1">SIT
<inputtype="checkbox" checked="checked" id="NftId" name="Nft1">NFT
<input type="checkbox" checked="checked" id="UatId" name="Uat1">UAT
<input type="checkbox" checked="checked" id="PrePodId" name="PreProd1">Pre-Prod
<input type="checkbox" checked="checked" id="ProdId" name="Prod1">Prod
here is a table
<table id="dataTable" border="1">
<tr>
<th>Serial No.</th>
<th">Message Flow Name</th>
<th>Description</th>
<th>PropertyKey</th>
<th>Development</th>
<th>CIT Value</th>
<th>SIT Value</th>
<th>NFT</th>
<th>UAT</th>
<th>Pre Prod</th>
<th>Prod</th>
</tr>
and some rows
<td><input type="text" name="seriql no.">
<td><input type="text" name="flow name">
<td><input type="text" name="description">
<td><input type="text" name="propertykey">
<td><input type="text" name="Dev">
<td><input type="text" name="Cit">
<td><input type="text" name="SIT">
<td><input type="text" name="NFT">
<td><input type="text" name="UAT">
<td><input type="text" name="Pre-Prod">
<td><input type="text" name="Prod">
</table>
问题::当我单击复选框说..“DevId”时,我希望“开发”列隐藏..当我再次勾选该复选框时,它应该是可见的..可能在 jquery 中..请帮助...提前致谢
<script>
$(document).on('change', 'table thead input', function() {
var checked = $(this).is(":checked");
var index = $(this).parent().index();
$('table tbody tr').each(function() {
if (checked) {
$(this).find("td").eq(index).show();
} else {
$(this).find("td").eq(index).hide();
}
});
});
</script>
我试过这个..需要一些指导..谢谢