<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>

<div class="spoiler">
  <div class="spoiler__content">Text</div>
  <div class="spoiler__toggler">Toggle</div>
</div>
.spoiler__content {
  width: 50px;
  height: 30px;
  background-color: tomato;
}

.spoiler__content--hide {
  display: none;
}
document.addEventListener("click", function (event) {
  const toggler = event.target.closest(".spoiler__toggler");
  if (!toggler) return;
  
  const content = toggler.parentElement.querySelector(".spoiler__content");
  content.classList.toggle("spoiler__content--hide");
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

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