Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Add – after() Method</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <style> body { font-family: Arial, sans-serif; padding: 30px; background: #f4f4f4; } h2 { color: #222; } button { padding: 10px 20px; background: #007BFF; color: white; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 20px; } .item { padding: 10px; background: #e0e0e0; margin-bottom: 10px; } .note { margin-top: 5px; padding: 8px; background: #ffc107; color: #000; border-radius: 4px; } </style> </head> <body> <h2>Add Content With after() Method</h2> <p>With <kbd>after()</kbd> method, you can insert content immediately following each element in the matched set. This is ideal for jQuery add content after element tasks.</p> <button id="addNote">Add Note After Item</button> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> <script> $(document).ready(function(){ $("#addNote").click(function(){ $(".item").after("<div class='note'>Note added</div>"); }); }); </script> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console