Which events are called? |
Which events are called? |
msucimaster |
Mar 21 2021, 04:13 PM
Post
#1
|
Newbie Group: Members Posts: 11 Joined: 29-April 20 Member No.: 27,307 |
I want to show a picture when an entry in a select box an entry is selected. It should be shown immediately as it is meant as a help for people to choose the right option. So I need to know which events are generated that I can use.
The selected box has multiple rows (size=4). Can someone help me with this information? |
pandy |
Mar 21 2021, 04:31 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,753 Joined: 9-August 06 Member No.: 6 |
onchange for the SELECT. The value for SELECT is the value of the chosen option.
CODE function getOption(x) { alert(x); } HTML <select onchange="getOption(this.value);"> <option selected>Choose a Pet</option> <option value="dog">Dog</option> <option value="cat">Cat</option> <option value="parrot">Parrot</option> </select> Note that the returned value is that of the value attribute, not what's visible on the page. So if the first option is chosen 'dog' not 'Dog' will be returned. |
msucimaster |
Mar 22 2021, 01:51 PM
Post
#3
|
Newbie Group: Members Posts: 11 Joined: 29-April 20 Member No.: 27,307 |
Thank you.
|
Lo-Fi Version | Time is now: 21st September 2024 - 11:04 AM |