Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Add – prependTo() Example</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: #28a745; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 20px; } .box { width: 100px; height: 100px; background: #28a745; margin: 5px; color: #fff; display: inline-flex; align-items: center; justify-content: center; } #container { padding: 20px; background: #fff; border: 2px dashed #ccc; min-height: 120px; display: flex; flex-wrap: wrap; } </style> </head> <body> <h2>jQuery Add – prependTo() Method</h2> <p>Click the button to <strong>add new green boxes</strong> at the start of the container using <code>prependTo()</code>.</p> <button id="addBox">Add New Box</button> <div id="container"></div> <script> $(document).ready(function(){ let count = 1; $("#addBox").click(function(){ $("<div class='box'>Box " + count++ + "</div>").prependTo("#container"); }); }); </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