I have an asp.net page, and I want to hide a div on the page when the index of the asp:DropDownList is 0 using javascript.
I know how to hide the div but I do need help on how to get the selected index of the asp:DropDownLists using javascript.
This is what I have in the javascript:
function hideDiv() {
var drpCampDock = document.getElementById('drpListCampaignDocketTemplate');
var drpCampType = document.getElementById('drpCampaignType');
when it gets to this check it gives an error.
if (drpCampDock.selectedIndex == 0) {
document.getElementById('divBuilderMain').style.visibility = 'hidden';
}
}
The error I get is
Microsoft JScript runtime error: Object required
asp:DropDownListlikedoc.getEleById("<%= drpListCampaignDocketTemplate.ClientID %>")and give it a try?