A jQuery selectors selects or finds a DOM (document object model) element in an HTML document. It is used to select HTML elements based on id, name, types, attributes, class and etc. It is based on existing CSS selectors.
#id
.className
[attributeName]
[attributeName ='value']
^=
: [attributeName ^= 'value']
$=
: [attributeName $='value']
*=
: [attributeName *= 'value']
:pseudo-selector
>
between selectors+
~
,
(comma) between selectorWhen writing selectors
for class
or id
or attribute
which contains some special characters like
!
"
#
$
%
&
'
(
)
*
+
,
.
/
:
;
<
=
>
?
@
[
\
]
^
{
|
}
~
the characters need to be escaped using two backslashes \\
.
eg.
<span id="temp.foobar"><span>
the selectors will be framed like,
$('#temp\\.foobar')