「jQuery入門.next([selector])のサンプル
書式
$(セレクタ名).next(クラス名).css(xxx)
使用例
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>next demo</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<p>Study skill </p>
<p class="cft">in argame</p>
<p>one 111</p>
<div><span>test123456</span></div>
<script>
$( "p" ).next( ".cft" ).css( "background", "red" );
</script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>next demo</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<p>Study skill </p>
<p class="cft">in argame</p>
<p>one 111</p>
<div><span>test123456</span></div>
<script>
$( "p" ).next( ".cft" ).css( "background", "red" );
</script>
</body>
</html>
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>next demo</title> <script src="https://code.jquery.com/jquery-3.5.0.js"></script> </head> <body> <p>Study skill </p> <p class="cft">in argame</p> <p>one 111</p> <div><span>test123456</span></div> <script> $( "p" ).next( ".cft" ).css( "background", "red" ); </script> </body> </html>