Display selected value on dropdown list after selecting |
Display selected value on dropdown list after selecting |
Kitesurfer |
Aug 17 2022, 02:32 AM
Post
#1
|
Group: Members Posts: 3 Joined: 17-August 22 Member No.: 28,510 |
Display selected value on dropdown list after selecting.
Hi, I am using https://www.w3schools.com/css/tryit.asp?fil...dropdown_button When making a selection see image attachment example: 1 - Wanaka or 2 - Queenstown When selecting "Queenstown or Wanaka or etc" I would like to have the selected value showing after making the selection. Hopefully, this is achievable. Kind regards Rudy This post has been edited by Kitesurfer: Aug 17 2022, 02:35 AM |
Christian J |
Aug 17 2022, 03:33 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
That's meant as a navigation menu, where clicking a link loads another page. QUOTE When making a selection see image attachment example: 1 - Wanaka or 2 - Queenstown When selecting "Queenstown or Wanaka or etc" I would like to have the selected value showing after making the selection. What do you mean with "selection" in this context? In the above dropdown menu, clicking a link would normally load the new page almost instantly. Are you thinking of the SELECT element, where you can select an OPTION value before submitting a form? See also https://htmlhelp.com/reference/html40/forms/select.html |
Kitesurfer |
Aug 17 2022, 05:37 AM
Post
#3
|
Group: Members Posts: 3 Joined: 17-August 22 Member No.: 28,510 |
That's meant as a navigation menu, where clicking a link loads another page. QUOTE When making a selection see image attachment example: 1 - Wanaka or 2 - Queenstown When selecting "Queenstown or Wanaka or etc" I would like to have the selected value showing after making the selection. What do you mean with "selection" in this context? In the above dropdown menu, clicking a link would normally load the new page almost instantly. Are you thinking of the SELECT element, where you can select an OPTION value before submitting a form? See also https://htmlhelp.com/reference/html40/forms/select.html What i mean is: When selecting Wanaka, the selected request would load the wanaka page but the button would show the word Wanaka instead of "Select or Clear Location", so that the user knows that the selected page is now page wanaka. Hope this makes sence. Cheers Rudy This post has been edited by Kitesurfer: Aug 17 2022, 05:39 AM |
Christian J |
Aug 17 2022, 08:58 AM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
When selecting Wanaka, the selected request would load the wanaka page but the button would show the word Wanaka instead of "Select or Clear Location" That would likely require javascript. A simpler idea might be to style the links in the menu with the CSS :active pseudo-class, then you can make the link highlighted at least while the mouse button is pressed down: https://www.w3.org/TR/2011/REC-CSS2-2011060...-pseudo-classes However, If you use a form SELECT menu for navigation, it should automatically display the selected OPTION value even when closed. See also https://jkorpela.fi/forms/navmenu.html I don't understand what the part "Clear Selected Location" is meant to do? It sounds like form Reset button, but that would have no purpose in a navigation dropdown menu like this one (unless you first select a Location and the press a "Go to Location" button). The demo at https://www.w3schools.com/css/tryit.asp?fil...dropdown_button doesn't use it either. |
Kitesurfer |
Aug 20 2022, 03:07 AM
Post
#5
|
Group: Members Posts: 3 Joined: 17-August 22 Member No.: 28,510 |
When selecting Wanaka, the selected request would load the wanaka page but the button would show the word Wanaka instead of "Select or Clear Location" That would likely require javascript. A simpler idea might be to style the links in the menu with the CSS :active pseudo-class, then you can make the link highlighted at least while the mouse button is pressed down: https://www.w3.org/TR/2011/REC-CSS2-2011060...-pseudo-classes However, If you use a form SELECT menu for navigation, it should automatically display the selected OPTION value even when closed. See also https://jkorpela.fi/forms/navmenu.html I don't understand what the part "Clear Selected Location" is meant to do? It sounds like form Reset button, but that would have no purpose in a navigation dropdown menu like this one (unless you first select a Location and the press a "Go to Location" button). The demo at https://www.w3schools.com/css/tryit.asp?fil...dropdown_button doesn't use it either. Hi, many thanks for your help. It seems I still have a lot to learn. I will read up on your suggestions. Kind regards Rudy |
Lo-Fi Version | Time is now: 25th April 2024 - 12:18 PM |