Skip to content Skip to sidebar Skip to footer

Javascript Toggling Element's Display Not Working

I've done this dozens of times, but for some reason I can't figure out why the #dropdown-list div isn't displaying when the #dropdown-button is clicked...

Solution 1:

You use the equality operator (==) instead of assignment (=):

        if(ele.style.display=='none')
            ele.style.display=='block';
        else
            ele.style.display=='none';

should be

        if(ele.style.display=='none')
            ele.style.display='block';
        else
            ele.style.display='none';

Post a Comment for "Javascript Toggling Element's Display Not Working"