Hi All,
In this chapter we will learn about the selectors, Before the selector, we should know about the factory function-
$() factory function -
The factory function is the functions from which the jQuery selector starts and they are dollar sign and parentheses $()
jQuery selectors -
jQuery selector permits us to select and manipulate HTML element(s) and we need it at every step while using jQuery which makes selectors one of the important part of jQuery
Basically, jQuery selector is used to select or find any HTMLment.
We can find HTML elements by their name, id, classes, types, attributes, values of attributes etc.
Universal (* symbolic star) selector -
This is work same as css, you use it in css.
It selects all elements available in a DOM. It means it can be applied with all.
$('*')
.class Selector -
The element select by the class name.
$("#some_class").hide();
#id Selector -
The element select by the id.
$("#some_id").hide();
Element or name selector -
The element select by the element name.
$("p") , $("span")
Types selector -
The element select by there input type.
$("button"), $(input[type="submit"])
Attributes Selector -
Example -
$("[href]")
0 Comment(s)