+ 1

JS help

Hi, Is it possible to build a hidden stuff like <div id="hiddenDiv" > <label>... </label>... </div> And make it visible with JS (for example after I clicked a button with onclick() ) ? and how can i hide it. Thanks.

13th Aug 2018, 10:45 PM
Med Arezki
Med Arezki - avatar
2 Answers
+ 1
Sure. You just need to ser display:none to hiddenDiv then via javascript you add display:block to id. First make button in html with id button You need to tako div and button to variable var div = document.getElementById("hiddenDiv") ; var button = document.getElementById("button") ; button.addEventListener("click", function() { div.style.display = "none" ; } ) Was typing on phone, sry if code have typo
13th Aug 2018, 11:09 PM
PandaThePumpkin
PandaThePumpkin - avatar
+ 1
Yes! thank you so much, that helps me a lot.
14th Aug 2018, 10:21 PM
Med Arezki
Med Arezki - avatar