FilterAttribute Filters
Name
Description
Example
[Attribute]
Match the element containing the given property
Find all DIV elements containing ID attributes: $ ("div[id]")
[Attribute=value]
Matches a given property as an element of a particular value
Find all the name attribute is the INPUT element of newsletter: $ ("input[name= ' newsletter
(4)") Select all TD elements in the TD element with an ordinal greater than 4 $ ("Td:ll (4)") selects all TD elements in the TD element with an ordinal less than 4 $ (": Header") $ ("div:animated") Content Filter Selector:$ ("Div:contains (' John ')") Select all the elements in the div that contain the John text$ ("Td:empty") Select all the arrays of TD elements that are empty (nor include text nodes)$ ("Div:has (P)") Select all DIV elements that contain p tags$ ("td:parent") Select all
This article mainly introduces a small example of jquery searching based on the name attribute. If you need it, refer to it.
The Code is as follows:
$ ("P [id]") select all p elements containing the id attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = 'Newsletter'] ") Select
") Select All visualized p elements
Attribute filter selector:$ ("P [id]") select all p elements containing the id attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = 'Newsletter'] ") Select the input element whose name attribute is not equal to '
div elements attribute filter selector: $ (" Div[id] ") Select all DIV elements with id attribute $ ("Input[name=" Newsletter '] ") Select all the name attribute equals ' newsletter ' INPUT element $ (" input[name!= ' newsletter '] ") Select all the name attribute is not equal to ' newsletter ' INPUT element $ ("i
elements to be hidden.$ ("Div: visible") Select All visualized div elements
Attribute filter selector:
Java code$ ("Div [id]") Select All div elements containing the id attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = 'Newsletter'] ") Select the input element whose name attribut
div elements attribute filter selector: $ (" Div[id] ") Select all DIV elements with id attribute $ ("Input[name=" Newsletter '] ") Select all the name attribute equals ' newsletter ' INPUT element $ (" input[name!= ' newsletter '] ") Select all the name attribute is not equal to ' newsletter ' INPUT element $ ("i
elements in the div that contain the John text$ ("Td:empty") Select all the arrays of TD elements that are empty (nor include text nodes)$ ("Div:has (P)") Select all DIV elements that contain p tags$ ("td:parent") Select all the element array with TD as parent nodeVisual Filter Selector:$ ("Div:hidden") Select all the hidden div elements$ ("div:visible") Select all of the visual DIV elementsAttribute Filter Selector:$ ("Div[id]") Select all DIV elements that contain the id attribute$ ("input[na
elements containing the ID attribute $ ("input [name = 'newsletter ']") select the input element whose name attribute is equal to 'newsletter' $ ("input [name! = 'Newsletter '] ") select all input elements whose name attribute is not equal to 'newsletter' $ (" input [name ^ = 'News'] ") select all input elements st
Attribute filter selector:$ ("Div [id]") Select All div elements containing the id attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = 'Newsletter'] ") Select the input element whose name attribute is not equal to 'newsletter '.$ ("Inpu
filter selector: 040 041 $ ("div [id]") Select All Div element 042 $ ("input [name = 'newsletter ']") select all name attributes to be equal to the input element 043 044 of 'newsletter' $ ("input [name! = 'Newsletter '] ") Select an input element 045 046 $ (" input [name ^ = 'News'] ") whose name attribute is not equal to that of '
TD as the parent node
5. Visual filter selector:$ ("Div: hidden") select all the DIV elements to be hidden.$ ("Div: visible") Select All visualized DIV elements
6. Attribute filter selector:$ ("Div [ID]") Select All DIV elements containing the ID attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = '
containing the ID attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.
$ ("Input [name! = 'Newsletter'] ") Select the input element whose name attribute is not equal to 'newsletter '.
$ ("Input [name ^ = 'News']") select all input elements whose name attri
containing P: $ ("Div: Has (p)"). addclass ("test ");
: Parent
Match an element containing child elements or text
Find all TD elements containing child elements or text: $ ("TD: parent ")
5. Visibility Filter
Visibility Filters
Name
Description
Example
: Hidden
Match all invisible elementsNote: In Version 1.3.2, hidden matches its own or parent class elements that do not occupy space in the document. If the CSS visibility attribute is used so that
hidden.$ ("Div: visible") Select All visualized div elements6. Attribute filter selector:$ ("Div [id]") Select All div elements containing the id attribute$ ("Input [name = 'newsletter ']") Select the input element whose name attribute is equal to 'newsletter'.$ ("Input [name! = 'Newsletter'] ") Select the input element whose name attribute is not equal to '
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 = '
Selector: $ Panax Notoginseng$ ("div:hidden"Select all of the hidden div elements -$ ("div:visible") Select all of the visual div elements the Attribute Filter Selector: + a$ ("div[id")Select all DIV elements that contain the id attribute the$ ("input[name= ' Newsletter ')" selects all the name attributes equal to ' newsletter 'the INPUT element + -$ ("input[name!= '
input tag element ("#prev ~ div") followed by the label tag directly following the label.
Basic Filter Selector
$ ("Tr:first") selects the first $ ("Tr:last") of all TR elements and selects the last $ ("Input:not (: Checked) + span") of all TR elements
ID Label class
$ ("#myELement") Select an element with an ID value equal to myelement. ID value cannot be repeated in the document only can have an ID value is myelement so get the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.