Example 1 — Count Hidden Elements and Show Divs
Official idea: tally hidden nodes, reveal hidden divs, count hidden inputs.
var hiddenElements = $("body").find(":hidden").not("script");
$("#log").text("Found " + hiddenElements.length + " hidden elements.");
$("div:hidden").show();
$("#inputs").text("Hidden inputs: " + $("input:hidden").length); How It Works
- Find. Scan
bodyfor:hiddenmatches. - Exclude.
.not("script")drops script nodes from the count. - Show.
$("div:hidden").show()reveals only hidden divs.

