html - Javascript not changing element attribute -
i trying change attribute "hidden" of element true javascript after timeout of 1,000 millisecond not changing attribute. yes timeout working fine i've tested that, functions correct! last part in using setattribute() function not working.
html:
<div id="gamepanel" hidden="true"> <div id="bb"> <div id="map"> </div> </div> <p id="status"> welcome back! </p> <input type="button" id="changebio" value="change map" /> <input type="button" id="savegame" value="save game" /> <div id="statusbar"> status </div> </div> javascript:
var panel = document.queryselector("#gamepanel"); panel.setattribute("hidden","false");
use
panel.removeattribute("hidden"); since hidden attribute boolean attribute, (the spec defines way),
the presence of boolean attribute on element represents true value, , absence of attribute represents false value.
then, doesn't have true , false values. can present (that is, hidden or hidden="hidden"), or not.
or, better, can change hidden property:
panel.hidden = false;
Comments
Post a Comment