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

104
Views
eliminar clase al hacer clic en otro elemento en el filtro

Hice un filtro con jQuery y funciona muy bien, también agrego una clase al botón al hacer clic, pero quiero que la clase se elimine al hacer clic en otro botón (actualmente agrega la clase en todas partes).

 $(function() { $(".filter-name").click(function() { selectedClass = $(this).attr("data-rel"); $(".filter-content div").not("." + selectedClass).hide(); $(this).toggleClass("active"); setTimeout(function() { $("." + selectedClass).show(); }); }); });
 .active { background: red; }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <div class="filters"> <button class="filter-name" data-rel="all">All</button> <button class="filter-name" data-rel="a">A</button> <button class="filter-name" data-rel="b">B</button> </div> <div id="content"> <div class="filter-content"> <div class="all a">a</div> <div class="all b">b</div> <div class="all a">a</div> <div class="all a">a</div> <div class="all b">b</div> <div class="all a">a</div> </div> </div>

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!