menu

jQuery Selectors


jQuery Selectors are used to select the element. jQuery selectors play an important role in jQuery library.


JQuery Selectors

jQuery Seletors are based on such as : Name, Id, Classes and many more…

The very basic selector(Name) example :

jQuery Selctors Example :

Try it »

Main jQuery Selectors

[table width=”100%” colwidth=”20|100|50″ colalign=”left|left|center|left|right”]
No,Selector
1, Name : The example of name tag are

2, Class :The example of class selector is –

Here class selector is “test”.
3, ID : The example of ID selector is –

Here class selector is “MainDiv”
[/table]

More jQuery Selectors

[table width=”100%” colwidth=”20|100|50″ colalign=”left|left|center|left|right”]
No,Selector,Example
1, $(“*”) : Selects all elements in the page. , See Detail & Demo »
2, $(this) :Selects current element.,See Detail & Demo »
3, $(“p.myclass”) : Selects all <p> which have class “myclass”.,See Detail & Demo »
4, $(“ol li:first”) : Selects first <li> element of the <ol>,See Detail & Demo »
5, $(“ol li:last”) : Selects last <li> element of the <ol>,See Detail & Demo »
6, $(“[href]”) : Selects all elements with “href” attributes.,See Detail & Demo »
7, $(“tr : even”) : Selects all even tr elements of the table.,See Detail & Demo »
8, $(“tr : odd”) : Selects all odd tr elements of the table.,See Detail & Demo »
[/table]