I'm currently having this code & looking for a simpler and shorter way of showing, hiding & disabling my elements...
$("#chReportData").click(function(){
if($(this)[0].checked){
$("#reportDataOptions").show();
} else {
$("#ReportDataStatusOptions").hide();
$("#reportDataOptions").hide();
$('#chkReportPermission').attr('checked', false);
$('#chReportDataStatus').attr('checked', false);
$('#chReportDataCummulative').attr('checked', false);
$('.allowedUpload').attr('checked', false);
$('.allowedDelete').attr('checked', false);
}
});
$("#chReportDataStatus").click(function() {
if ($(this)[0].checked) {
$("#ReportDataStatusOptions").show();
} else if ($('#chReportDataCummulative').is('checked')) {
$("#ReportDataStatusOptions").hide();
$('.allowedUpload').attr('checked', false);
$('.allowedDelete').attr('checked', false);
} else {
$("#ReportDataStatusOptions").hide();
$('.allowedUpload').attr('checked', false);
$('.allowedDelete').attr('checked', false);
}
});
It works fine, I'm just looking for a simpler way... If you know of a shorter & simpler way, please share...
Added HTML...
<label class="typ3">Report Data:</label><asp:CheckBox ID="chReportData" runat="server" CssClass="floatL shad1 trans1" ClientIDMode="Static"/><br class="floatClear" />
<span id="reportDataOptions" style="display: none;">
<label class="typ3">Report Management:</label><asp:CheckBox ID="chkReportPermission" runat="server" CssClass="floatL shad1 trans1" ClientIDMode="Static"/><br class="floatClear" />
<asp:RadioButton ID="chReportDataStatus" runat="server" ClientIDMode="Static" CssClass="floatL shad1 trans1" GroupName="reportData" Text="Report Type: Status" TextAlign="Left"/><br class="floatClear" />
<asp:RadioButton ID="chReportDataCummulative" runat="server" ClientIDMode="Static" CssClass="floatL shad1 trans1" GroupName="reportData" Text="Report Type: Cummulative" TextAlign="Left"/><br class="floatClear" />
</span>
<span id="ReportDataStatusOptions" style="display: none;">
<label class="typ3">Upload Files</label> <asp:CheckBox ID="chkAllowedUpload" runat="server" CssClass="floatL shad1 trans1" class="allowUpload"/><br
class="floatClear"/>
<label class="typ3">Delete Files</label> <asp:CheckBox ID="chkAllowedDelete" runat="server" CssClass="floatL shad1 trans1" class ="allowDelete"/><br
class="floatClear"/>
</span>