<div>
  <div>딸기</div>
  <div class="active">바나나</div>
  <div>수박</div>
</div>
// $div = $("div.active");
// $div.css("color", "yellow");
// $div.prev().css("color", "red");
// $div.next().css("color", "green");
// $div.parent().css("background", "black");

const divEl = document.querySelector("div.active");
divEl.style.color = "yellow";
divEl.nextElementSibling.style.color = "green";
divEl.previousElementSibling.style.color = "red";
divEl.parentElement.style.background = "black";

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js