To hide a label and a textbox
I have a label and a textbox. I want to show or hide them by a condition.
- <li id="visitation">
<label for="lblVisitation" style="float: left;">Visitation ID: </label><input type="text" id="txtVisitation" style="float: left;" class="ui-state-default ui-corner-all" />
<div style="clear: both;"></div>
</li>
The JavaScript code:
- if (FacilityDefaults.UseDualVisitation) {
$('label[for="lblVisitation"]').show();
$("#txtVisitation").show();
}
else {
$('label[for="lblVisitation"]').hide();
$("#txtVisitation").hide();
}
The funny thing is that when the condition is false, the controls showing instead of hiding.

Thanks