javascript - Setting a variable using the value of multiple selects, each time any of the selects is changed -


i have list of items i'm trying "filter" set of 4 selects matching value of select options classes have applied list items. right now, have working each time choose new option of 4 selects, entire list reset, , items class matches value of option selected visible. have work each time new option selected of 4 selects, filter values of 4 selects, not 1 changed.

here's have right - appreciated!

$(".sort-options select").change(function() {       var topics = $(this).val();       $(".list-schools li").hide().filter("." + topics).show();       }); 

$(".sort-options select").change(function() {       var topics = '';       $(".sort-options select").each(function() {           if ($(this).val()) { // create combined class .opt1.opt2.opt3               topics += "."+$(this).val();           }       });       $(".list-schools li").each(function() {           $(this).toggle($(this).is(topics));       });     }); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -