Why does my checkbox's text continue to show when I hide or slideUp the checkbox?
I have created a checkbox in the code-behind like so:
-
Checkbox ckbxSendPDFToThisEmailAddr = new CheckBox();
ckbxSendPDFToThisEmailAddr.Text = "Send PDF to this email address?";
ckbxSendPDFToThisEmailAddr.ID = "ckbxSendPDFToThisEmailAddr";
...and am endeavoring to conditionally show or hide it in the client/jQuery code based on which of two radio buttons the user selects:
-
$(document).on("click", '[id$=rbPaymentForSelf]', function () {
if (this.checked) {
. . .
$('[id$=ckbxSendPDFToThisEmailAddr]').slideUp();
. . .
}
});
$(document).on("click", '[id$=rbPaymentForSomeoneElse]', function () {
if (this.checked) {
. . .
$('[id$=ckbxSendPDFToThisEmailAddr]').slideDown();
. . .
}
});
The problem is, it is only the checkbox itself that is being hidden - the text ("Send PDF to this email address?") still displays. Isn't the text part of the checkbox, and it should show/hide along with it?
What do I need to do to make the checkbox recognize its text as part and parcel of itself?