I was wondering how to create a drop down menu to filter content. I have been searching the internet for 2 months and have yet to come across something or someone that will help me. This is the ONLY problem I have with this site I'm building for my boss. I would rather have jquery or javascript if possible, but at this point, I'll take whatever works. I really don't want just the answer either; please help me learn how this works.
So basically:
<select>
<optgroup label="Blue Buffalo">
<option value="can">can</option>
<option value="dry">dry</option>
</optgroup>
<optgroup label="Merrick">
<option value="can">can</option>
<option value="dry">dry</option>
</optgroup>
</select>
<div>
<div class="imgthmb"><a rel="lightbox" href="images/dog_blue_can_homestyle_beef.jpg">
<img class="imgthumb" src="images/dog_blue_can_homestyle_beef_thmb.png" /></a>
Blue Buffalo<br />
Canned Dog Food<br />
Homestyle<br />
beef
</div>
</div>
<div>
<div class="imgthmb"><a rel="lightbox" href="images/dog_merrick_can_96_tripe.jpg">
<img class="imgthumb" src="images/dog_merrick_can_96_tripe_thmb.png" /></a>
Merrick<br />
Canned Dog Food<br />
96%<br />
tripe
</div>
</div>
The users will be able to choose from the brand, only the canned products of that brand, or only the dry products of that brand. When a user makes a selection from the drop down menu, only the images and relative text that equal the option value will remain, and the rest will "hide".
Here is a draft of the site. As you can see, it's a lot for customers to deal with without a filter:
http://ssalinas5.mydevryportfolio.com/shadow/shadow/all4pets_dogs.html
Any help at all is so much appreciated. I'm tearing my hair out here.
UPDATE 6/30: So I'm trying all your suggestions, and nothing is working. I am pretty sure I understand the HTML part, but I am a designer, not a programmer, I don't understand the JQUERY parts at all. Anyone care to elaborate and teach me those parts?
JSONfile. UseHandlebarsor similar for templating. UseJQuery'sAJAXto read the file and filter the content.<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>before the$(document).readyfunction.