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

154
Views
Javascript data-filter and unselect button if one is selected

I have a set of buttons as per the HTML below. Once button is clicked, it will show the data set according to the data-filter.

Two questions.

  1. How do get everything to be displayed when I click on News button? (means no filter)
  2. Currently, when I click on the button, and click another button, the previous button will still be selected. How do I un-select the previous one when another button is clicked?

enter image description here

<div class="filters" id="getFixed">
  <div class="ui-group">
    <div class="button-group js-radio-button-group">
    <li class="sort-button" data-filter="">News</li>
      <li class="sort-button" data-filter=".instructor">Instructors</li>
      <li class="sort-button" data-filter=".clubs">Club Spotlight</li>
    </div>
  </div>
</div>
var filters = [];
$('.filters').on( 'click', '.sort-button', function( event ) {
  var $target = $( event.currentTarget );
  $target.toggleClass('is-checked');
  var isChecked = $target.hasClass('is-checked');
  var filter = $target.attr('data-filter');
  if ( isChecked ) {
    addFilter( filter );
  } else {
    removeFilter( filter );
  }
  $grid.isotope({ filter: filters.join(',') });
});

Thank you in advance!

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!