1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>next demo</title>
6 <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
7</head>
8<body>
9
10<p>Hello</p>
11<p class="selected">Hello Again</p>
12<div><span>And Again</span></div>
13
14<script>
15$( "p" ).next( ".selected" ).css( "background", "yellow" );
16</script>
17
18</body>
19</html>
20