简体   繁体   中英

Hide and Show div not working

I have this scenario.

Portion of my page gets refreshed on an action lets say on change of value of dropdown

and the divs in that portion get closed(hide) while actually

they should remain open if they were open and

should remain closed if they were closed, for this I put following check but it is not working.

if(dojo.style(dojo.byId('DivD1'), "display")== "none")
     dojo.style(dojo.byId('DivD1'), "display", "none");
else
     dojo.style(dojo.byId('DivD1'), "display", "block");

when I put this check divs always get open and visible,

even I put alert to check display property, it is 'none' in some cases but Divs always showsup.

what I am doing wrong?

if(dojo.style(dojo.byId('DivD1'),"display")=="none")
{
dojo.style(dojo.byId('DivD1'), "display", "none");
}
else
{
dojo.style(dojo.byId('DivD1'), "display", "block");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM