Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
When I clicked into Modal, the modal is not seen

I have a problem with Modal. When I clicked out of that, it works (remove class), but when I click into the Modal, it also works. I need when I click into that, the class has not to remove. For example, if I clicked .little-inputs into the modal, it also works.

The places I got in the red circle are working. Also in green. enter image description here

HTML

      <div class="detailed-search">
                <input readonly type="text" placeholder="Ətraflı axtarış" class="textBox"/>
                <div class="search-options">
                    <div class="detail-search-form">
                        <label for="floorMin">Mərtəbə</label>
                        <div class="little-inputs">
                            <div class="form-input">
                               
                   ..........
             
   
                </div>
            </div>

JS

       const detailSearch = document.querySelector(".detailed-search");
        const searchOptions = document.querySelector(".search-options");
        const textbox = document.querySelector(".textBox");
        const detailForm = document.querySelector(".detail-search-form");

        detailSearch.addEventListener("click", () => {
            searchOptions.classList.toggle("detailed-search-active")
        });

        window.addEventListener("click", (e) => {
            if (e.target == searchOptions || e.target == detailSearch || e.target == textbox || e.target == detailForm) {
                searchOptions.classList.add("detailed-search-active");
            } else {
                searchOptions.classList.remove("detailed-search-active");
            };
        });

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!