Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Callback Example – Multiple Selectors</title> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <style> body { font-family: Arial, sans-serif; padding: 2rem; background: #f0f4f8; } h2 { color: #2a4365; } h1, p { margin-bottom: 1rem; } #msgBox { margin-top: 1rem; padding: 0.5rem; background: #bee3f8; color: #2a4365; border-radius: 4px; display: none; } button { padding: 0.5rem 1rem; background: #2b6cb0; color: white; border: none; border-radius: 4px; cursor: pointer; } button:hover { background: #2c5282; } </style> </head> <body> <h2>Multiple-Element Callback Example</h2> <div>This example fades out both the heading and paragraph, and runs the callback once for each element.</div> <h1>Welcome to jQuery</h1> <p>jQuery makes DOM manipulation and animations simple.</p> <button id="multiBtn">Fade Out Heading & Paragraph</button> <div id="msgBox"></div> <script> $('#multiBtn').click(function(){ $('h1, p').fadeOut(400, function(){ // runs once per element (<h1> then <p>) console.log('Animation finished for ' + this.nodeName); }); }); </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