jQuery Syntax

jQuery syntax is made by using HTML elements. You can perform some action on those elements. jQuery starts with the dollar sign ($) and ends with a semicolon (;). Basic syntax of jQuery is: $(selector).action ()

  • $ symbol define the jQuery.
  • Selector is used to define the Query Elements in HTML document.
  • action () is used to define the action performed on the elements.

Examples:

$(this).hide (): This jQuery hide () function is used to hide the current element.
$("p").hide (): This jQuery hide () function is used to hide all <p> elements.
$(".test").hide (): This jQuery hide () function is used to hide all elements with class="test".
$("#test").hide (): This jQuery hide () function is used to hide the element with id="test".