Select me an item from a dropdown menu and place it next to the drop button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Select me an item from a dropdown menu and place it next to the drop button

I have a button named "Seasons". When it is hovered it displays dropdown list with items: "Spring", "Summer", "Autumn", "Winter". I want to browser to display each item, when I click on it, and to place the item next to "Seasons" button. Anybody knows how?

17th Jan 2017, 2:14 PM
Wolfinho
1 Answer
+ 1
I would suggest using the onchange event to fire a javascript function <select onchange="chkind()" id="myDropdownlist">, and then get the selected value from the dropdown list var e = document.getElementById("myDropdownlist"); var selectedItem= e.options[e.selectedIndex].value; and then add the selectedItem var to your new dropdownlist, or button or whatever you want :p I hope this helps you
1st Mar 2017, 7:47 AM
RJP
RJP - avatar