The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Which events are called?
msucimaster
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 21 2021, 04:31 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
msucimaster
post Mar 22 2021, 01:51 PM
Post #3


Newbie
*

Group: Members
Posts: 11
Joined: 29-April 20
Member No.: 27,307



Thank you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 04:22 PM