Javascript examples for jQuery Selector:visible
The :visible selector selects elements that are currently visible.
Visible elements are elements that are not:
The following code shows how to select all visible <p> elements:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p:visible").css("background-color", "yellow"); });// w w w. jav a2s .co m </script> </head> <body> <p style="display:none">This is a hidden paragraph.</p> <h1>This is a heading</h1> <p style="display:none">This is a hidden paragraph.</p> <p>This is a pargraph.</p> <p>This is another paragraph.</p> <p style="display:none">This is a hidden paragraph.</p> </body> </html>