Skip to content Skip to sidebar Skip to footer

Filtering Subsequent Dropdowns With Jquery

Hello and thank you for reading. I have 3 dropdown menus, 1 to filter, and 2 to submit values. What I need to do is have the 1st dropdown menu filter the values of the 3rd so that

Solution 1:

You are checking the value rather than if the option has the class. You want your if statement to be:

if(!$(this).hasClass(selectedValue)) {

You were checking each option's value to see if it matched the class. Which of course it didn't and that is why you were not filtering anything.

You can see it working here: http://jsfiddle.net/UqaqS/1/

Also, you really don't need to have two words in the value of your filtering dropdown, you could get by with just having All, Database, Web rather that Web Tier, etc. You could just filter by the first word. You are just adding a second class to all the options which doesn't seem to really matter.

Post a Comment for "Filtering Subsequent Dropdowns With Jquery"