8 Most useful Jquery Selectors - You Need To Know

8 Most useful Jquery Selectors - You Need To Know

Howdy coders,

In this tutorial, we are going to show some useful uses of Jquery selectors.

Selectors are a very useful part of jquery. In Jquery selectors are used to select any HTML elements and perform some action on them Like add some animation on the element, make the element fade in-out or call some function on element click, etc….

Let’s start,

1.Attribute selector:

UsesAttribute selector is used for the select element which has the selected attribute.

For Example:

//select element which has title attribute
//select element which has title=service attribute

2.this selector:

Uses: This selector is used for select particular elements when an event occurred.

For Example:

//To select particular element when event occured 
$('p').click(function () {
   //This will hide slected elemets on click event

3.Odd-even selector:

Uses: Odd-Even Selector is used to selecting odd and even elements from HTML.

For Example:

//To select odd element
//To select even element

4.First last selector:

Uses: The first-last selector is used to selecting first or last elements.

For Example:

//To select First Element 
//To select Last Element

5.nth Element  selector:

Uses: nth Element selector is used to selecting any element according to its

For Example:

//To select nth element

6.not Selector:

Uses: not selector is used when you want to not to select an element from given.

For Example:

//Do not select 3rd element

7.Form field selector:

Uses: Form field selector is used to select any form input

//To select all input fields
//To select input with type=password

8.Contains selector:

Uses: Contains selector is used to finding which elements contains selected text.

For Example:

     //Find 'Jigar' from elements and show it		


So, These are some basic uses of Jquery selectors. Thanks for reading.

Do let me know If you face any difficulties please feel free to comment below we love to help you. if you have any feedback suggestions then please inform us by commenting.

Don’t forget to share this tutorial with your friends on Facebook and Twitter 

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

You might also like

Leave a Comment