Search results

  1. Studi

    JavaScript How to close the selection if I click outside?

    const selectBtn = document.querySelectorAll(".select-btn"); const options = document.querySelectorAll(".select-btn label"); selectBtn.forEach(function (button, index) { button.addEventListener("click", () => { button.classList.toggle("active"); selectBtn.forEach(function (button2...
  2. Studi

    JavaScript How can I include document?addEventListener in this function.

    Yes, and I don't get any errors. But I can tell the if statement is not working the way I want. I mean without the if statement it's working properly but then I can't open the dropdown as it sets the aria expanded to false on all click when I want only after.
  3. Studi

    JavaScript How can I include document?addEventListener in this function.

    I have a few dropdown selection lists and want them to exit if you click anywhere on the site/document(make the aria-expanded false) because at the moment it exits only if you click on itself or one of the items inside the dropdown. const selection =...
Top Bottom