javascript - jQuery dropdown not displaying first option -
so, have dropdown filter on client web page, dropdown should work matching class in hidden div , displaying relevant content. however, in ie9 (and on linked fiddle) can see doesn't work.
the second option (iphone) doesn't appear display results. think issue down numbering of 'select.dropdown' function can't figure out is, exactly.
snippet:
$("select.dropdown").change(function(){ var filters = $.map($("select.dropdown").toarray(), function(e){ return $(e).val(); }); var filter; if(filters[0]=="all") { if(filters[1]=="all") filter = ""; else filter = "." + filters[1]; } else{ if(filters[1]=="all") filter = "." + filters[0]; else filter = "." + filters.join("."); } $("div#filtercontainer > div").hide(); $("div#filtercontainer").find("div" + filter).show(); console.log(filters);
any ideas?
the filtering works on ie10+ , chrome & firefox..
thanks in advance!
in html filter value not correct.
<option value="iphone">iphone</option>
value should have capital 'p'
Comments
Post a Comment