#id
To select an element by the ID attribute. If the ID contains
special character then you can escape them with backslashes. For example to
find a text box with ID txtName you can write the following :
$("#txtName")
Then you can do any operation on
the text box like getting the value or changing the css class.
element
To find all the elements in the
page with the given element name. For example to get all the DIV elements
following is the syntax
$("div")
This will find all the DIVs
present in the page. You can do any operation after that.
.class
To find all elements with the
given class name. The following code finds all the elements which have class
name 'RedButton'.
$(".RedButton")
*
This finds all the elements in the
document. The syntax is
$("*")
selector 1, selector 2,
selector N
This matches the combined result
of all the specified selectors. We can specify N number of selectors to get a
single result. Suppose you want to find all the DIVs, a text box with ID
'txtName' and a Button with class name 'RedButton'. Then following is the syntax:
$("div, #txtName, .RedButton")
Suppose you want to change the
border color of all these elements then write :
$("div, #txtName, .RedButton").css("border","3px
solid blue");
It will change all the specified
elements' border color to blue.