jquery - How to filter images by .class using drop down box -


i looking around @ question
how filter images category using input form , jquery?

its sorta question , tried playing around of jsfiddles had no success. http://jsfiddle.net/3bk22/44/

<img src="http://placehold.it/123x100/123/1" class='landclass' />  <img src="http://placehold.it/100/fe2/2" class='landclass' />  <img src="http://placehold.it/100x50/aaa/3" class='absclass' />  <img src="http://placehold.it/200x150/42e/4" class='landclass' /> <br/> <br/> filter: <br/> <select> <option value="abstract" /> abstract<br /> <option value="landscape" /> landscape<br /> </select>  $('option[value="landscape"]').click(function(){ $('.landclass').toggle();  });  $('option[value="abstract"]').click(function(){     $('.absclass').toggle(); }); 

i wan't know if can create filter 850+ images after given class. going use checkbox, there 50+ categories , hoping minimize area required box.

what trying achieve?
- drop down filter categories.
- drop down menu can add unlimited categories to.
- default on load displays box empty.
- hiding image isn't apart of current filter.

you should either tweak class names or dropdown, consistent, , this:

$("select").change(function(){     $("img").hide();     $("." + $(this).val()).show(); }); 

http://jsfiddle.net/3bk22/45/


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -