in the set of matched elements.
All 3 example in the jquery website are using. After (content [, content]), which is described in a simple. After (function) code.
$ ("P"). After (function() { returnthis. ClassName + "</div>";,});
After the actual test, it is found that function can only return the HTML string as it is possible to return Element or jquery problem (perhaps my usage is incorrect):
<body><div class= "P" > <p id= "M" > Added content </p> <div id= "C" > <p>first paragraph</p> <p>second paragraph</p> </div></div><script> $ ("#c > P"). After (function (index, e) {
Return $ ("#m"). html () +index;
Return $ ("#m"); Have a problem
Return $document. getElementById ("M"); Have a problem
}); </script></body>
/* Test for problematic results: only after the 2nd P element is added.
First Paragraph
Second Paragraph
What to add
*/
The jquery official said online. After () and. InsertAfter () Complete the same task.
API-. After