Jquery operations on DOM elements (2)

Source: Internet
Author: User
Jquery operations on DOM elements (2). after ()
Insert the content specified by the parameter after each element in the matched element set as its sibling node.
. After (content [, content])
Content HTML string DOM element array object, used to insert to the end of each Matching Element in the set.
Content HTML string DOM element array object, used to insert to the end of each Matching Element in the set.
. After (function)
Function returns an array of DOM element elements of an HTML string, which is inserted after each Matching Element in the set. This points to the current position.
Structure:
    


Greetings
      

Hello


      

Goodbye


    


$ ('. Inner'). after ('

Test

');
Effect:
    


Greetings
      

Hello


      

Test


      

Goodbye


      

Test


    


. Before ()
Insert content before matching parameters according to parameter settings.
. After (content [, content])
Content HTML string DOM element array object, used to insert to the end of each Matching Element in the set.
Content HTML string DOM element array object, used to insert to the end of each Matching Element in the set.
. After (function)
Function returns an array of DOM element elements of an HTML string, which is inserted after each Matching Element in the set. This points to the current position.
Structure:
    


Greetings
      

Hello


      

Goodbye


    


$ ('. Inner'). before ('

Test

');
Effect:
    


Greetings
      

Test


      

Hello


      

Test


      

Goodbye


    


. InsertAfter ()
Insert each Matching Element in the set after the target element. The inserted element serves as the sibling element of the target element.
. InsertAfter (target)
Target a selector, element, HTML string or object. matched elements are inserted after the target specified by the parameter.
Structure:
    


Greetings
      

Hello


      

Goodbye


    


$ ("

Test

"). InsertAfter ('. insertAfter ');
Effect:
    


Greetings
      

Hello


      

Test


      

Goodbye


      

Test


    

. InsertBefore ()
Insert each Matching Element in the set before the target element. The inserted element serves as the sibling element of the target element.
. InsertBefore (target)
Target a selector, element, HTML string or object. matched elements are inserted before the target specified by the parameter.
Structure:
    


Greetings
      

Hello


      

Goodbye


    


$ ("

Test

"). InsertBefore ('. insertAfter ');
Effect:
    


Greetings
      

Test


      

Hello


      

Test


      

Goodbye


  

The above is the content of jquery DOM element (2). For more articles, please follow the PHP Chinese Web (www.php1.cn )!

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.