Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery prop() Example – Toggle All Checkboxes (Callback)</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <style> body { font-family: sans-serif; padding: 30px; background: #f0f0f0; } .checkbox-list { margin-bottom: 20px; } label { display: block; margin: 5px 0; } button { padding: 8px 15px; background: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer; } </style> </head> <body> <h2>Newsletter Preferences</h2> <div class="checkbox-list"> <label><input type="checkbox" checked> Weekly Updates</label> <label><input type="checkbox"> Promotions</label> <label><input type="checkbox" checked> Product Announcements</label> <label><input type="checkbox"> Feedback Requests</label> </div> <button id="toggleCheckboxes">Toggle All</button> <script> $(document).ready(function(){ $('#toggleCheckboxes').click(function(){ $('input[type="checkbox"]').prop('checked', function(index, currentChecked){ return !currentChecked; }); }); }); </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