I have been trying to hide a Textbox if a Checkbox is checked again display it if the checkbox is unchecked Source Code goes like below.
<asp:CheckBox ID="ShortStoryCheckBox" runat="server" />
<asp:TextBox ID="LeadTextBox" runat="server" Height="77px" TextMode="MultiLine"
Width="370px"></asp:TextBox>
So my aim is to hide LeadTextBox if ShortStoryCheckBox is checked. If it is unchecked again I have to display it. To accomplish that I tried below piece of JQuery. Below the Id's I have used are HTML id that I got from source view of browser.
<script type="text/javascript">
$("#ctl00_PlaceHolderMain_Home_ShortStoryCheckBox").change(function () {
if (this.checked) {
$("#ctl00_PlaceHolderMain_Home_LeadTextBox").hide();
}
else {
$("#ctl00_PlaceHolderMain_Home_LeadTextBox").show();
}
});
</script>
But it is not working, can anybody please help me how could I do it? or where I am going wrong? Any alternate suggestion to achieve it would also be very helpful.