Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Move – append() 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: #f9f9f9; } h2 { color: #222; } button { margin: 20px 0; padding: 10px 20px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; } .lists { display: flex; gap: 40px; } ul { width: 200px; padding: 20px; background: #fff; border: 1px solid #ddd; border-radius: 4px; min-height: 120px; list-style: none; } li { margin-bottom: 8px; color: #333; cursor: pointer; } .label { font-weight: bold; margin-bottom: 8px; } </style> </head> <body> <h2>Move Items Between Lists with <code>append()</code></h2> <p>Click the button to move the first item from the left list into the right list.</p> <button id="moveItem">Move Item →</button> <div class="lists"> <div> <div class="label">Source List</div> <ul id="sourceList"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> </div> <div> <div class="label">Target List</div> <ul id="targetList"> <!-- moved items appear here --> </ul> </div> </div> <script> $(function(){ $("#moveItem").on("click", function(){ // select the first <li> from #sourceList var $item = $("#sourceList li:first"); if ($item.length) { // use append() on the target container $("#targetList").append($item); } else { alert("No more items to move."); } }); }); </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