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

124
Views
Multiple Tab Handling with JS (DOM)
<ul class="search-tabs">
<li class="rent active">Rent</li>
<li class="buy">Buy</li>
<li class="sell">Sell</li>
</ul>

<form id='rent' class='visible'>
<form id='buy'>
<form id='sell'>

This is my code and I wan't to create a feature that does the following:

  • adds 'active' into the li's classList, when I click it.
  • but only when the form has className = 'visible' and that form's id = the clicked li's classList. Else, it removes the 'active' from the li's classList.

It adds the 'active' class, but doesn't remove the 'active' class from the other li's that have not been clicked. Any solution? Please help!

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!