Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery animate() Predefined Values</title> <style> body { font-family: Arial, sans-serif; padding: 20px; } .box { width: 200px; height: 100px; background: #2196F3; margin: 20px 0; opacity: 1; } button { padding: 10px 20px; margin-right: 10px; background: #333; color: #fff; border: none; border-radius: 5px; cursor: pointer; } </style> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> </head> <body> <h3>Animate Width</h3> <p>Toggle the width of the box using jQuery <kbd>animate()</kbd>.</p> <button id="toggleWidth">Toggle Width</button> <div class="box" id="box1"></div> <h3>Animate Height</h3> <p>Toggle the height of the box using jQuery <kbd>animate()</kbd>.</p> <button id="toggleHeight">Toggle Height</button> <div class="box" id="box2"></div> <script> $(document).ready(function() { $('#toggleWidth').click(function() { $('#box1').animate({ width: 'toggle' }, 500); }); $('#toggleHeight').click(function() { $('#box2').animate({ height: 'toggle' }, 500); }); }); </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