HTML:
<div style="display:block">Text</div>
<div style="display:block">Text</div>
<div style="display:none">Text</div>
<div style="display:none">Text</div>
<div style="display:none">Text</div>
How do I find first invisible block and make it visible?
If there is no invisible block, do nothing.
HTML:
<div style="display:block">Text</div>
<div style="display:block">Text</div>
<div style="display:none">Text</div>
<div style="display:none">Text</div>
<div style="display:none">Text</div>
How do I find first invisible block and make it visible?
If there is no invisible block, do nothing.
Share Improve this question asked Mar 4, 2011 at 16:16 JamesJames 43.7k54 gold badges137 silver badges163 bronze badges3 Answers
Reset to default 12$('div:hidden:first').show();
div
theelement-selector
[docs]:hidden
thehidden-selector
[docs]:first
thefirst-selector
[docs]
Use this:
$('div:hidden:first').show();
jQuery has the :visible and :hidden selectors:
$('#wrapperContainer > div:hidden:first').show();
(Remend a wrapper container because if you just do 'div:hidden:first' it will get the first hidden div on the page, which probably isn't what you want)