Prev Demo
jQuery
>
.After() - Place Content After Element
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <h1 style="color:red">This is H1</h1> <h2 style="color:green">This is H2</h2> <h3 style="color:skyblue">This is H3</h3> <script> $("h1").after("<h2>This should be the sub heading</h2>"); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output