Reseting DIVs with new Selection
My jQuery is a filter system that takes a pre-made & displayed set of DIVs tb.container and can filter then by selecting an item from the drop down filter box. How can I make it so when a person selects WINDOWS and it filters them and then the person decides to choose MAC it will reset all tb.containers to SHOW and then HIDE al tb.containers that do not run on MAC. My Code:
- //#filterBox1 Starts
- $('#filterBox1').change(function() { // when value of filterBox1 changes
- var selection = $(this).val(); // get it's value
-
- if (selection == 'Windows') { // if windows is selected from OS
-
- $(".tb-container:not(:has(img.windows))").hide(); // Hide all DIVs that do not contain img.windows
- }
- if (selection == 'Mac') { // if mac is selected from OS
- $(".tb-container:not(:has(img.mac))").hide(); // Hide all DIVs that do not contain img.mac
- }
- if (selection == 'Linux') { // if linux is selected from OS
- $(".tb-container:not(:has(img.linux))").hide(); // Hide all DIVs that do not contain img.linux
- }
- });//#filterBox1 Ends