Coding

jQuery Syntax – jQuery Tutorial

Task

jQuery Syntax

Description

The jQuery syntax is tailor-made for the selecting HTML elements and performing the some action on the element(s).

Basic syntax is: $(selector).action()

A $ sign is to define/access jQuery
A (selector) is to “query (or find)” HTML elements
A jQuery action() is to be performed on the element(s)
Examples:

$(this).hide() – hides the current element.

$(“p”).hide() – hides all

elements.

$(“.test”).hide() – hides all elements with class=”test”.

$(“#test”).hide() – hides the element with id=”test”.

Example

<script>
$(document).ready(function(){
 
   // jQuery methods go here...
 
});
</script>