How Do I Have a Dropdown menu change a picture on screen? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How Do I Have a Dropdown menu change a picture on screen?

I am unsure if I am doing this right but this is my first combination of css js and html in one code. I would like to make the drop down menu change the mountain to the desert picture and vice-versa. I dont know how to set up the drop down link to the id of the picture I already have when i run the console. https://code.sololearn.com/WERiM011ezta/?ref=app

3rd Jul 2018, 4:52 PM
Evan Martine
4 Answers
+ 2
I would suggest including an id in your img tag and use event.target.text to check for the text in the drop-down list instead of matches. [edit]I miss read your comments about the drop-down box, so forget the part about instead of matches. I would add another function that has an event parameter to change the image using event.target.text - https://code.sololearn.com/WI23Q3NT1oSj/#html
3rd Jul 2018, 7:06 PM
ODLNT
ODLNT - avatar
+ 3
Hello, Coming In Second ! Please write in more detail, and then people will be able to help you.
3rd Jul 2018, 6:33 PM
Alexander Sokolov
Alexander Sokolov - avatar
+ 1
Alexander Sokolov I updated my description of my conundrum. Does that help alittle?
3rd Jul 2018, 6:41 PM
Evan Martine
+ 1
Could I make an id for each drop down then make a function to manipulate the picture on screen?
3rd Jul 2018, 6:53 PM
Evan Martine