jQuery Tutorial
jQuery Syntax: Know What is Syntax of jQuery
Table of Contents
- What is Syntax of jQuery?
What is Syntax of jQuery?
With jQuery, you can select HTML elements (query them) and perform "actions" on them.
The jQuery syntax is designed specifically for selecting HTML elements and performing actions on them.
Basic syntax of jQuery is: $(selector).action()
-
To define/access jQuery, use a
$
sign. -
To "query (or find)" HTML elements, a (selector) is used.
-
A jQuery action() that will be applied to the element (s)
Examples:
-
$(this).hide():
The current element is hidden. -
$("p").hide():
All p> elements are hidden. -
$(".test").hide():
All elements with the class="test" are hidden. -
$("#test").hide():
The element with the id="test" is hidden.