jQuery Syntax - action on HTML elements

All jqueries are basically an interplay between an HTML elememt and some kind of action on them. Let us formally take a look at jQuery Syntax

jQuery Syntax

A Typical jQuery function looks as follows

- A jQuery function starts with $ sign.
- The (selector) defines which HTML element that needs to be found or queried.
- Finally, once the HTML element is found, the action() defines what needs to be done on that html element.

The formal definition looks a little bit abstract, so we would like to understand it with an example

- It will hide all paragraph elements ( We checked this in example in previous page)

- hides all elements with class="foo".

- hides the element with id="foo

The $() factory function:

The $() function, also called a factory function - is a synonym of jQuery() function. If you are using other JavaScript library where $ sign is conflicting you can replace $ sign by jQuery and can use jQuery() in place of $().

The initial parts of the tutorial is divided into two parts. In the first part we will learn how to select an HTML element. We will learn how to select an html entity ( like a table or a header) , a class, an id. We will also learn how to apply the selection to a subset of the entity. In the initial tutorial we will know only one of two type of the action - that too just so that we complete tutorial. In the second part of the tutorial we will learn about different actions that we can perform on these selection.

In the next page we will learn about jQuery Selectors.