How to Use jQuery hide() function for hiding the current HTML element

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

<button type="button">Click me</button>


The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).
Basic syntax is: $(selector).action()

  • A dollar sign to define jQuery
  • A (selector) to "query (or find)" HTML elements
  • An jQuery action() to be performed upon the element(s)
$(this).hide() - hides current element
$("p").hide() - hides all paragraphs
$("p.test").hide() - hides all paragraphs with class="test"
$("#test").hide() - hides the element with id="test"

No comments:

Post a Comment

Please Provide your feedback here