We help IT Professionals succeed at work.
Get Started

Change div when dropdown changes

djfenom asked
Last Modified: 2012-08-13
I have a dropdown which displays colours for clothing garments. When a colour is selected I would like it so that a div changes to show the image applicable to that colour.

I need it so that a different div is changed on each selection, so for example if the first selection is selected then a div called div_img1 is shown, if the second is selected then a div called div_img2 is shown. I would also need to hide the toggled divs as well.

The selections in the menu won't always have an image to change to so this needs to be beared in my mind too.

And finally, the options in the select dropdown already have a value which will be the same as the colour to select, but the divs that change need to have the same name, such as div_img1, div_img2, etc.

Any ideas?


Watch Question
IT Expert
Top Expert 2009
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE