javascript - jQuery filters sometimes showing all elements -
when toggle between jquery filters show elements class, selected filter shows elements , not ones respective class. you can see in below fiddle. switch between select options , they'll show results. fiddle. function activatebuttons(_data){ $('.jobs-teams select').on("change", function(e) { e.preventdefault(); for(i = 0; < _data.length; i++) { var teamraw = _data[i].title; var team = cleanstring(teamraw); var jobs = $(".jobs-list"); if ($(this).find(":selected").hasclass(team)) { if ($(this).hasclass("active")) { $(this).removeclass("active"); jobs.find(".job").fadein("fast"); } else { $(".jobs-teams").find("a").removeclass("active"); $(this).addclass("active"); jobs.find("."+team).fadein("fast"); jobs.find(".j