Method |
Describe |
Example |
Append () |
Append content to each matching element |
HTML code:<p> I want to say:</p> jquery Code: $ ("P"). Append ("<b> hello </b>"); Results: <p> I want to say hello,:<b> </b></p> |
Appendto () |
Appends all matching elements to the specified element 。 In fact, using this method reverses the general The action of $ (A). Append (b) is to append A to B. |
HTML code:<p> I want to say:</p> jquery Code: $ ("<b> Hello </b>"). Appendto ("P") Results: <p> I want to say hello,:<b> </b></p> |
Prepend () |
Forward content to each matching element |
HTML code:<p> I want to say:</p> jquery Code: $ ("P"). prepend ("<b> Hello </b>") Results: <p><b> Hello </b> i want to say:</p> |
Prependto () |
To place all matching elements in the specified element 。 In fact, using this method is upside down General $ (A). prepend (B) operation. |
HTML code:<p> I want to say:</p> jquery Code: $ ("<b> Hello </b>"). Prependto ("P") Results: <p><b> Hello </b> i want to say:</p> |
After () |
Insert content after each matching element |
HTML code:<p> I want to say:</p> jquery Code: $ ("P"). After ("<b> Hello </b>") Results: <p> I want to say hello,:</p><b> </b> |
InsertAfter () |
Inserts all matching elements into the specified meta element of the back, in fact, using this method is reversed the regular $ (a). After (B) operation |
HTML code:<p> I want to say:</p> jquery Code: $ ("<b> Hello </b>"). InsertAfter ("P") Results: <p> I want to say hello,:</p><b> </b> |
Before () |
Insert content before each matching element |
HTML code:<p> I want to say:</p> jquery Code: $ ("P"). Before ("<b> Hello </b>") Results: <b> Hello </b><p> i want to say:</p> |
InsertBefore () |
Inserts the matching element into the point The front of the set element. As a matter of fact Using this method is reversed the general The operation of $ (A). Before (B). |
HTML code:<p> I want to say:</p> jquery Code: $ ("<b> Hello </b>"). InsertBefore ("P") Results: <b> Hello </b><p> i want to say:</p> |
The above is the entire content of this article, I hope you can enjoy.