The Way to Programming
The Way to Programming
Probably an easy one, but I’m not sure how to do it right now, as i’m currently looking for tutorials already.. So I hope someone wants to help me out.
http://jsfiddle.net/blackvibes/wFCU7/1/
I’ve pasted the relevant code in there.
What I want to achieve: There are two dropdowns. The option selected of the second drop down will change the src of the image.
The best thing to happen i’d say would be something like
or something.. Or just in simple words, just as in the comment in JSfiddle: The best option is that the name of the selected dropdown option (SECOND ONE), such as ‘WN.000.019’ (+.png) will be the new SRC.
I hope someone could help.
I think something like this might help you out.
$(function(){ $('#plattegrondGo').change(function(){ var newSrc = $('#plattegrondGo option:selected').attr('name'); $("#plattegrond").attr('src', newSrc + '.png'); }); });
When working with drop down boxes it’s better to use change, as it will only fire when the dropdown value actually changed
Sign in to your account