jQuery nextUntil() with Example

jQueryWeb DevelopmentFront End Technology

The nextUntil() method in jQuery is used to return all next sibling elements between the selector and stop.


The syntax is as follows −


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>
   .one {
      color: white;
      background-color: green;
      font-size: 16px;
      border: 2px blue solid;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<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>


This will produce the following output −

Updated on 05-Nov-2019 12:05:08