Hi I have a dropdownlist and a div inside update panel. I want to togg开发者_Go百科le div using javascript on dropdownlist selection change that is inside update panel. but it is not working.
function DistrictChange() {
debugger;
var ddldistrict = document.getElementById('<%=DDLDistrict.ClientID %>');
var dvOther = document.getElementById('<%=divOthrDistrict.ClientID %>');
if (ddldistrict.options[ddldistrict.selectedIndex].text == 'Other') {
dvOther.style.display == 'block';
}
else {
dvOther.style.display == 'none';
}
}
The problem is this line of code :
dvOther.style.display == 'none';
== is compare statement.
Use this for assignment :
dvOther.style.display = 'none';
精彩评论