In jQuery, to select all siblings div after a child we use a function nextAll().
Syntax:
$(element).nextAll();
For example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="main">
<div id="one">First div</div>
<div id="two">Second div</div>
<div id="three">Third div</div>
<div id="four">Fourth div</div>
</div>
In above code, we need to change the background color of all the div that are coming after the second div. For this you need to add the following script:
<script type="text/javascript">
$('#two').nextAll().css( "background-color", "blue" );
</script>
0 Comment(s)