Is there any mechanism to display a child element when its parent element is display: none?
The situation is a validation error on a hidden tab. I want to surface the error message, even though the field is hidden.
A really simplified JSFiddle of the situation is here http://jsfiddle.net/vLYnk/
Markup:
<ul>
<li>One</li>
<li class="hide">
Two
<ul>
<li class="reshow">Re Show Me</li>
<li>Inner 2</li>
</ul>
</li>
<li>Three</li>
</ul>
CSS:
.hide {display: none}
.reshow {display: block !important; position: fixed; top: 0; left: 0;}
I’m guessing this is impossible as the child would have no context, but just in case???
No this isn’t possible.
display:nonehides the element, and thus any child elements will not be displayed.EDIT:
This might be along the lines of what you want, if you’re able to switch from using
displaytovisibility.Using this method you can hide the contents of the parent element but show the specific
<li>you want. The only caveat is the parent markup will still take up screen real estate. Just won’t be shown to the user. That may or may not break the layout you’re looking for.http://jsfiddle.net/vLYnk/2/