top of page

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

  • A $ sign to define/access jQuery

  •  A (selector) to "query (or find)" HTML elements

  •  A jQuery action() to be performed on the element(s)

 


$(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".

 


Are you familiar with CSS selectors?

jQuery uses CSS syntax to select elements.

 

The Document Ready Event
You might have noticed that all jQuery methods in our examples, are inside a document ready event:
$(document).ready(function(){ // jQuery methods go here... });

Jquery Syntax

Are the Keywords

bottom of page