7 January 2014

jQuery Syntax

The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).
Basic syntax is: $(selector).action()
  1.  A $ sign to define/access jQuery
  2.  A (selector) to "query (or find)" HTML elements
  3.  A jQuery action() to be performed on the element(s)
Examples:

$(this).hide() - hides the current element.
$("p").hide() - hides all <p> elements.
$(".test").hide() - hides all elements with class="test".
$("#test").hide() - hides the element with id="test".

No comments:

Post a Comment