+ 2
24th Feb 2021, 4:48 PM
Tree Lover
Tree Lover - avatar
4 Respostas
+ 2
Thanks for the reply. They were very helpful.
24th Feb 2021, 7:18 PM
Tree Lover
Tree Lover - avatar
+ 1
But you change different attributes in each function. So will work: function ol(){ var a=document.getElementById("a").style.visibility="visible" } function cl(){ var a=document.getElementById("a").style.visibility="hidden" } And this: function ol(){ var a=document.getElementById("a") .style.display="block" } function cl(){ var a=document.getElementById("a") .style.display="none" }
24th Feb 2021, 5:07 PM
JaScript
JaScript - avatar
0
display and visibility (or opacity with 1 or 0 as value) are two different ways to hide/show an element. 'display: none;' remove element from flow (as it's not part of the page), so space used by it is not preserved. you should provide a valid 'display' value, or remove the style to show it again... 'visibility:hidden|visible;' toggle 'opacity' of element from 0 to 1, so space used by it is preserved.
24th Feb 2021, 5:15 PM
visph
visph - avatar