Select current and next element
Description
The following code shows how to select current and next element.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w w w.j a v a 2 s . com-->
$("div.selected").next().andSelf().css("background", "yellow");
});
</script>
</head>
<body>
<body>
<div>java2s.com</div>
<div>java2s.com</div>
<div>java2s.com</div>
<div class="selected">java2s.com</div>
<div>java2s.com</div>
</body>
</html>