开发者

how to toggle div inside update panel using javascript. asp.net

开发者 https://www.devze.com 2023-03-12 11:58 出处:网络
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.

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'; 
0

精彩评论

暂无评论...
验证码 换一张
取 消