

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery nextUntil() with Example
The nextUntil() method in jQuery is used to return all next sibling elements between the selector and stop.
Syntax
The syntax is as follows −
$(selector).nextUntil(stop,filter)
Above, the stop parameter is to mention the expression to stop the search for next matching sibling elements and the filter parameter is a selector expression to narrow down the search
Let us now see an example to implement the jQuery nextUntil() method −
<!DOCTYPE html> <html> <head> <style> .one { color: white; background-color: green; font-size: 16px; border: 2px blue solid; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p.demo1").nextUntil("p.demo2").addClass("one"); }); </script> </head> <body> <h1>Match Details</h1> <p class="demo1">Date: 29th October 2019</p> <p>Timings: 3PM TO 8PM</p> <p>Ground: Lords</p> <p class="demo2"> Entry begins 2PM</p> </body> </html>
Output
This will produce the following output −
- Related Questions & Answers
- jQuery appendTo() with Example
- jQuery closest() with Example
- jQuery dblclick() with Example
- jQuery fadeOut() with Example
- jQuery find() with Example
- jQuery first() with Example
- jQuery focus() with Example
- jQuery click() with Example
- jQuery blur() with Example
- jQuery focusin() with Example
- jQuery finish() with Example
- jQuery addClass() with Example
- jQuery focusout() with Example
- jQuery change() with Example
- jQuery parentsUntil() with Example
Advertisements