Dropdown menu - select option to show multiple <div> items

Hi,

I’m using a bit of Javascript to display content based on the dropdown selection:
http://jsfiddle.net/mcgarriers/wjLXk/

However, I would like it when the user selects “show two” that it shows the 2 div elements rather than specifically div2.

And for “show three” it would show all 3 divs.

How do I achieve this?

Many thanks for any pointers.

You would loop through the select box values twice. Once to hide all of the divs, and a second time to show the divs. until you get to the one that was selected. Once you reach the one that was selected, you can break out of the loop.

You would loop through the select box values twice. Once to hide all of the divs, and a second time to show the divs. until you get to the one that was selected. Once you reach the one that was selected, you can break out of the loop.