Home >>jQuery Tutorial >jQuery visible Selector
jQuery visible selector in jQuery is used to selects every element that is currently visible.
Form elements with type="hidden"
Set to display:none
Width and height set to 0
Syntax:$(":visible")Here is an Example of jQuery :visible Selector
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p:visible").css("background-color", "#97d7fc");
});
</script>
</head>
<body>
<h1>This is a heading</h1>
<p>This is First pargraph.</p>
<p>This is Second paragraph.</p>
<p style="display:none">This is a hidden paragraph.</p>
</body>
</html>
This is First pargraph.
This is Second paragraph.