[ACCEPTED]-How can I show an element that has display: none in a CSS rule?-html
Because setting the div
's display
style property to 7 ""
doesn't change anything in the CSS rule 6 itself. That basically just creates an "empty," inline CSS 5 rule, which has no effect beyond clearing 4 the same property on that element.
You need 3 to set it to something that has a value:
document.getElementById('mybox').style.display = "block";
What 2 you're doing would work if you were replacing 1 an inline style on the div, like this:
<div id="myBox" style="display: none;"></div>
document.getElementById('mybox').style.display = "";
document.getElementById('mybox').style.display = "block";
0
try setting the display to block in your 1 javascript instead of a blank value.
I can see that you want to write you own 6 short javascript for this, but have you 5 considered to use Frameworks for HTML manipulation 4 instead? jQuery is my prefered tool for 3 such a task, eventhough its an overkill 2 for your current question as it has SO many 1 extra functionalities.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.