Juqery learns the attributes of the selector visibility element. For more information, see. : Hidden matches all invisible elements. If the type attribute of the input element is "hidden", it will also be matched Matches all elements that are hidden, or input elements of type "hidden". Return Value
Array
Example
Search for all invisible tr Elements
HTML code:
JQuery code:
$ ("Tr: hidden ")
Result:
[Value 1]
Bytes ---------------------------------------------------------------------------------------
: Visible matches all visible elements Matches all elements that are visible. Return Value
Array
Example
Search for all visible tr Elements
HTML code:
JQuery code:
$ ("Tr: visible ")
Result:
[Value 2]
Bytes ---------------------------------------------------------------------------------------
[Attribute] matches the element containing the given attribute Matches elements that have the specified attribute. Return Value
Array
Parameters
Attribute(String): attribute name
Example
Search for all the p elements containing the id attribute
HTML code:
Hello!
JQuery code:
$ ("P [id]")
Result:
[
]
Bytes ---------------------------------------------------------------------------------------
[Attribute = value] matching a given attribute is an element of a specific value Matches elements that have the specified attribute with a certain value. returned value
Array
Parameters
Attribute(String): attribute name
Value(String): attribute value. Quotation marks are optional in most cases. However, it is used to avoid conflicts when an attribute value contains.
Example
Find all input elements whose name attribute is newsletter
HTML code:
'
JQuery code:
$ ("Input [name = 'newsletter ']"). attr ("checked", true );
Result:
[ , ]
Bytes ---------------------------------------------------------------------------------------
[Attribute! = Value] matching a given attribute is an element that does not contain a specific value Matches elements that don't have the specified attribute with a certain value. returned value
Array
Parameters
Attribute(String): attribute name
Value(String): attribute value. Quotation marks are optional in most cases. However, it is used to avoid conflicts when an attribute value contains.
Example
Find all input elements whose name attribute is not newsletter
HTML code:
'
JQuery code:
$ ("Input [name! = 'Newsletter '] "). attr (" checked ", true );
Result:
[ ]
Bytes ---------------------------------------------------------------------------------------
[Attribute ^ = value] matching a given attribute is an element starting with some values Matches elements that have the specified attribute and it starts with a certain value. Return value
Array
Parameters
Attribute(String): attribute name
Value(String): attribute value. Quotation marks are optional in most cases. However, it is used to avoid conflicts when an attribute value contains.
Example
Find all input elements whose names start with 'new'
HTML code:
JQuery code:
$ ("Input [name ^ = 'News']")
Result:
[ , ]
Bytes ---------------------------------------------------------------------------------------
[Attribute $ = value] matches the given attribute with elements ending with some values. Matches elements that have the specified attribute and it ends with a certain value. Return value
Array
Parameters
Attribute(String): attribute name
Value(String): attribute value. Quotation marks are optional in most cases. However, it is used to avoid conflicts when an attribute value contains.
Example
Find all input elements whose names end with 'letter'
HTML code:
JQuery code:
$ ("Input [name $ = 'Letter ']")
Result:
[ , ]
Bytes ---------------------------------------------------------------------------------------
[Attribute * = value] matching a given attribute is an element that contains certain values. Matches elements that have the specified attribute and it contains a certain value. Return value
Array
Parameters
Attribute(String): attribute name
Value(String): attribute value. Quotation marks are optional in most cases. However, it is used to avoid conflicts when an attribute value contains.
Example
Find all input elements whose names contain 'man'
HTML code:
JQuery code:
$ ("Input [name * = 'man']")
Result:
[ , , ]
Bytes ---------------------------------------------------------------------------------------
[Selector1] [selector2] [selectorN] composite attribute selector, which must meet multiple conditions at the same time. Matches elements that have the specified attribute and it contains a certain value. Return value
Array
Parameters
Selector1(Selector): attribute Selector
Selector2(Selector): another property Selector to further narrow down the scope.
SelectorN(Selector): any number of attribute selectors
Example
Find all the attributes that contain id and whose name attributes end with man.
HTML code:
JQuery code:
$ ("Input [id] [name $ = 'man']")
Result:
[ ]