Treehouse: Grow your CSS skills. Land your dream job.

I’ll give you a cookie if you can tell me what’s wrong

  • # December 17, 2012 at 11:07 am

    I have two selects on my page

    I use some jquery for client side filtering

    var $cat = $(‘select[name=category]’),
    $items = $(‘select[name=items]’);

    var $this = $(this).find(‘:selected’),
    rel = $this.attr(‘rel’),
    $set = $items.find(‘option.’ + rel);

    if ($set.size() < 0) {


    $‘selected’, true);

    I’m using the latest version of jquery, dunno why my selects are behaving the way that they do.

    I got the idea from this jsfiddle

    here’s my jsfiddle

    I’ll give you a cookie for enlightening me!


    # December 17, 2012 at 11:25 am

    it works fine for me i don’t know what is wrong for you? Sorry!

    # December 17, 2012 at 11:43 am

    it’s filtering for you? Are you sure?

    # December 17, 2012 at 1:22 pm

    Working fine for me too:

    (though I wouldn’t use just numbers as class names)

    # December 17, 2012 at 1:42 pm

    What browser are you using @KMarimon1?

    # December 17, 2012 at 2:53 pm

    It’s not working correctly for me; it just jumps to the start of the relevant part of the drop down list, but does not filter out the irrelevant cities. I’m using Safari 6.0. Also does not work on Chrome 23.0.1271.101. Does work on Firefox 13.0.1 though

    Unfortunately, I don’t have much skill in Javascript, so I’ll leave it to those more experienced, but thought you’d want to know what browsers it’s functioning in :)

    # December 17, 2012 at 4:21 pm

    Did a bit of research and found another solution for you that seems to be working in all of the browsers I’m using. I can’t take _any_ of the credit, but I will take _all_ of the cookies :D

    Solution found [here]( “”).

    Codepen example with your data [here]( “”)

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.