Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>jQuery find() – Select All Descendant Elements</title> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <style> body { font-family: Arial, sans-serif; background-color: #f4f7fa; padding: 30px; } h2 { color: #2c3e50; } .description { color: #555; margin-bottom: 20px; } .container { border: 2px solid #3498db; padding: 15px; background-color: #ecf0f1; width: 400px; cursor: pointer; } .box { margin: 8px 0; padding: 10px; background-color: #d6eaf8; border: 1px solid #5dade2; } .deep { margin-top: 5px; padding: 8px; background-color: #f9e79f; border: 1px dashed #f1c40f; } .highlight { background: #ff3f3f55; border-color: #ff3f3f; } </style> </head> <body> <h2>jQuery find() – Select All Descendants</h2> <p class="description"> Click the main container to highlight <strong>all matching descendants</strong> (including nested) using the <kbd>find('.deep')</kbd> method. </p> <div class="container"> <div class="box"> Level 1 <div class="deep">Deep 1</div> </div> <div class="box"> Level 2 <div class="box"> Level 3 <div class="deep">Deep 2</div> <div class="box"> Level 4 <div class="deep">Deep 3</div> </div> </div> </div> </div> <script> $(function () { $('.container').on('click', function () { $('.deep').removeClass('highlight'); // Clear previous highlights $(this).find('.deep').addClass('highlight'); }); }); </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