"use strict"; // the event handler for the click event of each

element const toggleVisibility = evt => { const h2 = evt.currentTarget; // get the

element const div = h2.nextElementSibling; // get the
element h2.classList.toggle("minus"); div.classList.toggle("open"); evt.preventDefault(); // cancel default action of child element }; document.addEventListener("DOMContentLoaded", () => { // get the

elements const h2s = document.querySelectorAll("#faqs h2"); // attach event handler for each

tag for (let h2 of h2s) { h2.addEventListener("click", toggleVisibility); } // set focus on first tag h2s[0].firstChild.focus(); });