Hide a div using dropdownbox
hello all, i have a dropdownlist with countries in it and i am using jquery to switch between two hidden divs depending on selection, everything works great once i make a selection but how do i get it to show right when the page loads
- <script language="javascript" type="text/javascript">
$(function () {
$('#<%= Country.ClientID %>').change(function (e) {
var selectedText = $('#<%= Country.ClientID %> option:selected').text();
if (selectedText == "--Select--")
{
$('#State').hide(400);
$('#Providence').hide(400);
}
else
if (selectedText == "United States")
{
$('#State').show(400);
$('#Providence').hide(400);
}
else
{
$('#State').hide(400);
$('#Providence').show(400);
}
return false;
});
});
</script>
- <asp:DropDownList ID="Country" runat="server">
<asp:ListItem Value="">--Select--</asp:ListItem>
<asp:ListItem>United States</asp:ListItem>
<asp:ListItem>Yugoslavia</asp:ListItem>
<asp:ListItem>Zaire</asp:ListItem>
<asp:ListItem>Zambia</asp:ListItem>
<asp:ListItem>Zimbabwe</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>
<div id="State">State:</div>
<div id="Providence">Providence:</div>
Any help would be great, i am using asp.net in vb