How jQuery Selectors works

0
(0)

How jQuery Selectors works

In order to work with any element on the web page, we would first need to find it.
jQuery Selectors is a function used to select and manipulate HTML elements. They are very important part of jQuery library.
With jQuery selectors, you can find or select HTML elements based on their id, classes, attributes, types and much more from a DOM.

 

All jQuery selectors start with a dollor sign and parenthesis e.g. $(). It is known as the factory function.
The $() factory function
The factory function $() is a synonym of jQuery() function.

 

By Element Name : Name: Used to select all elements which matches the given element Name.
select a paragraph
$(‘p’)

 

By Element Id: #ID: Used to select a single element which matches with the given ID
select by id of an element
$(‘#some-id’)

 

By Element Class: .Class: Used to select all elements which match with the given Class.
Universal (*): Selects all elements available in a DOM.
select by class of an element
$(‘.some-class’)

 

More on jQuery …

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

1 Trackback / Pingback

  1. jQuery Interview Questions - etechstuffs

Leave a Reply

Your email address will not be published.


*


two × 3 =