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 conventional $ (A). Append (b) operations, that is, not append B to A, but 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 () |
All matching elements are placed in front of the specified element. In fact, using this method reverses the conventional $ (A). Prepend (b) operation, that is, not to place B before A, instead of placing a in front of B |
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 behind the specified element. In fact, using this method reverses the conventional $ (A). After (b) operation, that is, not inserting B into a Behind, but instead inserts a after B |
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 all matching elements in front of the specified element. In fact, using this method reverses the conventional $ (A). Before (b) operation, that is, not inserting B To the front of a, instead of inserting a in front of 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> |