I'm trying to show MeetingDiv when IsAnonymous
is checked and when IsMeeting
is checked, MeetingTextBox should be shown.
Tried .click
, .change
and live
and nothing worked. I don't know where I'm wrong.
<div class="col-md-4 sidePad" >
@Html.Label("Is Anonymous")
@Html.CheckBoxFor(p => p.IsAnonymous, new { id = "CBAnonymous"})
</div>
<div class="col-md-6" id="MeetingDiv" style="display:none">
@Html.Label("Is Meeting")
@Html.CheckBoxFor(p => p.IsMeeting, new { id = "CBMeeting"})
</div>
<div class="col-md-6" id="MeetingTextBox" style="display:none">
@Html.Label("Meeting Name")
@Html.TextBoxFor(p => p.MeetingName, new { id = "TBMeetingName"})
</div>
<script>
$(function () {
$("#CBAnonymous").click(function () {
if ($(this).prop("checked")) {
$("#MeetingDiv").show();
} else {
$("#MeetingDiv").hide();
}
});
});
</script>