4-30 jq study notes (optional)

1 option a--by name  

        $('tag') Example: $('a') selects all tags

       $('#id name') Example: $('#a1') selects the tag whose id is equal to a1 $('#a1: attribute value ddd') selects all tags whose id is equal to a1 and contains the ''attribute value ddd""
       $('.classname') Example: $('.a1') selects all tags whose class name is a1: $('div.a1') selects tags whose type is div and whose class name is equal to a1

 Example: $('.a1 div') selects all hierarchical div tags included under the a1 tag with all class names

  Example: $('.a1>div') selects all first-level sub-div tags contained under the a1 tag with all class names

                         Example: $('.a1.b1') selects all tags with class name a1 and b1

                        Example: $('.a1,b1') selects all tags with class name a1 or b1

        $([attribute name=attribute value]) and $([attribute name=attribute value]) 

                         Example: $('[for]') selects all tags whose attribute names contain for

                         Example: $("[type='text']"') selects all tags whose attribute name is type and whose value is text

                         Example: $(':text') The form type is an input tag, which can be directly abbreviated as an input tag whose attribute value is text

2 option b-pass filter

      $(this).next() The next label of the current selection set, you can set conditions for precise filtering

      $(this).prev() The previous label of the current selection set, you can set conditions for precise filtering

      $(this).parent() The parent tag of the current selection set, you can set conditions for precise filtering

       $(this).childern() The child tag of the current selection set, you can set the condition for precise filtering
       $(this).siblings() The sibling tag of the current selection set, you can set the condition for precise filtering

 

3 Selection method c - Chain selection by filter

      $(this).next(condition
).parent(condition).siblings(condition).first() Get the first of the set of sibling tags of the next parent tag of the current tag 

 

4 Choice method d - miscellaneous choices

      $(this).eq(1) Take the 2nd of the current tag set

      $(this).last() takes the last one of the current tag set

      $(this).find(condition) Get the qualified tags of the current tag set


 

 

 

   

 

 

    

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325114375&siteId=291194637