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 nextUntil() – Select Siblings Until Match</title> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <style> body { font-family: Arial, sans-serif; background: #f7f7f7; padding: 30px; } h2 { color: #333; } .description { color: #555; margin-bottom: 20px; } .container { border: 2px solid #ccc; padding: 20px; background: #fff; width: 400px; } .box { background: #e3f2fd; border: 1px solid #64b5f6; padding: 12px; margin: 8px 0; cursor: pointer; } .stop-here { background: #ffe082; border-color: #fbc02d; } .highlight { background: #ffcdd2; border-color: #e53935; } </style> </head> <body> <h2>jQuery nextUntil() – Get Next Siblings Until Stop</h2> <p class="description"> Click any item to highlight <strong>all next siblings</strong> up to (but not including) the <span class="stop-here">"STOP"</span> box using <kbd>nextUntil()</kbd>. </p> <div class="container"> <div class="box">Item A</div> <div class="box">Item B</div> <div class="box">Item C</div> <div class="box stop-here">STOP</div> <div class="box">Item D</div> <div class="box">Item E</div> </div> <script> $(function () { $('.box').on('click', function () { $('.box').removeClass('highlight'); // Reset previous highlights $(this).nextUntil('.stop-here').addClass('highlight'); // Highlight siblings until STOP }); }); </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