Reputation: 416
I have a hidden control (an asp.net label) and want to show it when a user clicks a button.
Here is the hidden control
<asp:Label ID="lblCityRequired" visible="False" runat="server" Text="Required if Country State are selected"></asp:Label>
Here is the javascript code
function showLabel()
{
$("#lblCityRequired").show();
}
function hideLabel()
{
$("#lblCityRequired").hide();
}
This only works when the label's visibility is not set to false. However I want the form to start up hiding the message. Is there something I am doing wrong? Should I just create a javascript function that starts up hiding the label via javascript?
Thanks in advance
Upvotes: 1
Views: 1186
Reputation: 8291
You can hide it initally when dom is ready:
$(function(){
hideLabel();
})
Or, you can use css:
<style>#lblCityRequired{display:none;}</style>
Upvotes: 1