.insertAfter()
Run
↔
<!doctype html> <html lang="vi"> <head> <meta charset="utf-8"> <title>Học web chuẩn</title> <script src="https://code.jquery.com/jquery-latest.js"></script> <script> $(function(){ $('<p>Thành phần p được chèn</p>').insertBefore('div.test'); }); </script> </head> <body> <div class="test">Thành phần div</div> <div class="test">Thành phần div</div> </body> </html>