jQuery Selector :hidden

Introduction

The :hidden selector selects hidden elements.

Hidden elements are elements that are:

  • display:none
  • Form elements with type="hidden"
  • Width and height set to 0
  • from hidden parent element

This selector will not work on elements with visibility:hidden.

$(":hidden")

Show hidden <p> elements:

View in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p:hidden").show(3500);
});//w ww  .j  av a  2s .c  om
</script>
</head>
<body>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<p style="display:none;">This is a hidden paragraph that is slowly shown.</p>

</body>
</html>



PreviousNext

Related