:visible (since jQuery 1.0) selects elements that consume space in the document. Official docs: they typically have width or height greater than zero. It is the opposite of :hidden.
Remember
$("div:visible") // visible divs (official style)
$(".panel").filter(":visible") // faster pattern (official tip)
// Still :visible (consume space):
// visibility: hidden
// opacity: 0
// Not :visible:
// display: none
// <option> elements (always hidden in jQuery)
// Opposite: :hidden
Scope with a CSS selector first, then filter or bind only the visible matches.
Start with a tag or class: $("div") or $(".card").
Narrow with :visible or .filter(":visible") (preferred).
Remember: visibility:hidden and opacity:0 still match.
Treat display:none (and detached nodes) as not visible.
Re-query after .show() / .hide() if the set must stay current.
Piece
Required?
Role
Selector string
Yes
:visible filter (best after a CSS scope)
Context / class
Recommended
Limits how many elements are tested
Return value
—
jQuery collection of visible matches
Pseudocode
Pseudocode
matches = []
for each element in search context:
if element is in the document
and element consumes layout space:
matches.add(element)
return matches
// Official performance tip:
candidates = CSS_query(…)
return candidates.filter(isVisible)
Reference
Cheat Sheet
Keep these facts handy while testing visibility.
Topic
Detail
Syntax
$("elem:visible")
Since
jQuery 1.0 · jQuery extension
Means
Consumes layout space
Opposite
:hidden
visibility:hidden
Still :visible
opacity: 0
Still :visible
display: none
Not visible
<option>
Always hidden in jQuery
Performance
.filter(":visible") after CSS
Try it
Live Preview
Toggle panels, then count div:visible vs div:hidden in this mini demo.
Panel A
Panel B
Panel C (starts hidden)
Same idea as the official demo: only elements that currently take layout space match :visible.
Result
div:visible → 2
div:hidden → 1
/* Panel C is hidden */
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console with jQuery loaded, or use Try It Yourself for a live editor.
Example 1 — Official Demo: Click div:visible
Only currently visible divs get the click handler (jQuery API idea).
jQuery
$("div:visible").on("click", function () {
$(this).text($(this).text() + " ✓");
});
$("#showHidden").on("click", function () {
$("div:hidden").show();
});
3 panel(s) visible
Click a panel → count decreases
Reset → back to 3
How It Works
Count.$(".panel:visible").length is the open panel total.
Hide on click. Each click removes one from the visible set.
Update. Re-run the count after every change.
Reset..show() restores every panel to visible.
Edge Cases & Pitfalls
Check these before relying on :visible in real UIs.
eye vs layout
opacity:0 is still visible
Official docs: visibility:hidden and opacity:0 match :visible because they still take space.
option
<option> is never :visible
All options are treated as hidden. Use :selected for dropdown choices.
perf
Can force layout / reflow
Heavy use may re-render before visibility is known. Prefer classes or .filter(":visible") after a CSS query.
animation
During hide/show animations
While hiding, the element stays :visible until the animation ends; while showing, it is visible from the start.
Compatibility
Browser Support
The :visible pseudo-class is a jQuery extension and has worked since jQuery 1.0. Visibility tests run through jQuery’s engine; use scoped .filter(":visible") or state classes when performance is critical. jQuery 3 refined zero-size layout boxes.
✓ jQuery 1.0+ · extension
jQuery :visible Selector
Supported across jQuery 1.x, 2.x, and 3.x. Prefer .filter(":visible") after a CSS selector for better performance.
100%jQuery visibility selector
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
:visibleUniversal
Bottom line: Safe everywhere jQuery runs. Remember layout-space rules, avoid bare scans on large DOMs, and pair with :hidden for the complementary set.
Analysis
Performance Notes
Approach
Cost
Best for
$("div").filter(":visible")
Best
Official recommended pattern
$(".panel:visible")
OK
Small scoped sets
Visibility class
Often cheaper
Frequent checks in apps
$(":visible")
Expensive
Avoid — tests the whole document
Official docs: :visible cannot use querySelectorAll, and heavy use may force layout. Prefer CSS scoping plus .filter(":visible"), or track open/closed state with a class.
Remember
Key Takeaways
Role: match elements that consume layout space.
Not eye-based:opacity:0 / visibility:hidden still match.
One line:$(":visible") means “takes layout space,” not “you can see it” — scope first, then filter.
Frequently Asked Questions
:visible selects elements that consume space in the document layout. Visible elements typically have a width or height greater than zero (jQuery 3 also includes elements with any layout box). Available since jQuery 1.0. It is the opposite of :hidden.
Yes. Official docs: elements with visibility:hidden or opacity:0 still consume layout space, so jQuery treats them as :visible.
Yes. Every element selected by :visible is not selected by :hidden, and vice versa.
No. Official docs: all option elements are considered hidden, regardless of selected state. Use :selected for dropdown options.
No. It is a jQuery extension and cannot use querySelectorAll. Official tip: select with a CSS selector first, then .filter(":visible").
Starting with jQuery 3, elements with any layout boxes — including br and empty inline elements with zero width/height — can match :visible.