jQuery Note 3 - jquery filter

Filter the jQuery

Filter syntax description:

1 has been positioned on the object dom jQuery objects, filtered secondary screening

2. The filter can not be used independently, it must be declared after the selector

3. six kinds of filters (three common filters)

4. The plurality of filters into the same function jQuery

(1) The basic filter:

1. [Filter Condition] : jQuery secondary screening filter stored in the object according to the position of the object has been positioned DOM

2. [Use]:

$ ( "Selector: first"): The first conditions is met leave a DOM object

Examples: $ ( ": button: first"): the first page positioning button

$ ( "Selector: last"): a DOM object left last meet conditions

Examples: $ ( ": button: first"): Positioning page last button

$ ( "Selector: eq (index)"): left to meet the conditions specified in the DOM object

Examples: $ ( "div: eq (2)"): page positioning in the third div

$ ( "Selector: lt (index)"): all the DOM objects leave the specified position conditions is satisfied

Examples: $ ( ": checkbox: lt (2)"): positioning the first two pages checkbox

$ ( "Selector: gt (index)"): After leaving the DOM object satisfies all conditions specified index

Examples: $ ( ": checkbox: gt (2)"): Location page of the index is after all checkBox

(2) basic properties of the filter:

1. [Filter Condition]: The labels are manually assigned to the specified attribute declaration

                            The filtering properties of the label with the content [the specified content] Relationship

2. [Examples]:

<input type="text"/>

<input type="text" name="two" />

<input type="text" name="three" />

<input type="text" name="four" />

 

Question 1: Which input did not name attribute
     A: have, but first there is no manual assignment
Question 2: What is the name attribute of a div ""
     A: First, because the first no manual assignment

3. [Use]:

     1) $ ( "selector [attribute name]"): and satisfies the targeting left when the declaration

          Manual assignment for the specified property dom objects

 

例子:$(":text[name]")<input type="text" name="two" />
           <input type="text" name="three"/>

 

                  2) $ ( "selector [property name = 'value']"): the left and the attribute satisfies the targeting content equal to
                       attributes of the content objects dom

例子:$(":text[name='']"):<input type="text"/>

   $(":text[name!='four']"):<input type="text"/>

   <input type="text" name="two" />

   <input type="text" name="three" />

 

                  3) $ ( "selector [^ property name = 'value']"): left and satisfies the targeting content specified attribute [beginning with the specified content] dom all objects

 

例子:$(":text[name^='t']"):<input type="text" name="two" />

          <input type="text" name="three" />


                 4) $ ( "selector [$ property name = 'value']"): left and satisfies the targeting property values specified in [designated contents ending] dom all objects

                     example: $ ( ": text [name ^ = 'e'] "): < input type =" text "name =" three "/>

                5) $ ( "selector [* Property name = 'value']"): left and satisfies the conditions specified attribute targeting SUMMARY [] contains all the objects specified content DOM

例子:$(":text[name*='o']"):<input type="text" name="two" />

           <input type="text" name="four"/>

               6) $ ( "selector [Properties Name 1] [2 * Property name = 'value'] [3 ^ attribute name =" attribute value "]")

(3) Operation attribute filters:

1.html tag attribute Category:

1) basic attributes: Most tags have attributes, [id, name, title, rowspn] ....

2) style attribute: background, fonts, borders

3) value attributes: [there is only form fields in the label (input, select, textarea)]

4) the operating state properties: there is only a form field tag [checked, disabled, selected]

5) monitor event attribute: onclick, onchange ...

2. [Use]:

1) $ ( "Selector: enabled"): and satisfies the condition is left available state [the] dom

Examples: $ ( ": button: enabled"): locate all the available state of the button

2) $ ( "Selector: disabled"): and satisfies the condition is left [in the unavailable state] dom

Examples: $ ( ": button: disabled"): all the positioning button is in the unavailable state

3) $ ( "selector: checked"): left to meet the conditions and in the dom [selected]

Examples: $ ( ": checkbox: checked: first"): the first page positioning selected checkBox

4) $ ( "selector: selected"): leave and meet the conditions selected in [the] dom (option of)

Examples: $ ( "select> option: selected"): drop-down list in the selected option

Guess you like

Origin www.cnblogs.com/wwww2/p/12129851.html
Recommended