Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Move with insertBefore()</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: #f9f9f9; } .header { background: #2196F3; color: white; padding: 20px; margin-bottom: 15px; border-radius: 4px; } #dealBanner { background: #FF5722; color: white; padding: 15px; border-radius: 4px; margin-bottom: 15px; } button { padding: 10px 20px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 20px; } </style> </head> <body> <h2>jQuery Move with insertBefore()</h2> <p>Click the button to move the deal banner above the header section.</p> <button id="addPromo">Show Deal Banner</button> <div class="header">Main Header Section</div> <div id="dealBanner">Special Deal Banner</div> <script> $(document).ready(function(){ $("#addPromo").click(function(){ $("#dealBanner").insertBefore(".header"); }); }); </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