$(document).ready(function () { $("#nextAll").click(function () { $(".css").removeClass("css").nextAll().addClass("css"); }); });
<html> <head> <title>nextAll</title> </head> <body> <div> <p class="css">This is paragraph element. This is colored.</p> <div>This is div element.</div><br> <span>This is span elment.</span><br /> </div><br /> <input type="button" id="nextAll" value="nextAll" /> <input type="button" id="reset" value="Reset" onclick="location.reload()" /> </body> </html>
.css { color:Aqua; font-size:30px; }