How can I organize an unordered list as a dropdown list with a choice of value?
There is an unordered list of languages.
<ul id="lng-menu1" class="lng-menu"> <li class="active"><a href="/ru">RU</a></li> <li><a href="/en">EN</a></li> </ul>
The active class is assigned to li by clicking on the link with the language version (that is, this feature already exists and is not needed in the code).
Both links are visible on the page:
It is necessary that only the active language is shown, and when clicked, a "drop-down list" of languages is shown, when choosing a language, the selected one is shown again and the link is followed. Again, the "active" class is already assigned to the selected language when the link is clicked.
On the Internet, there were only solutions with an "initial" value, such as "select something", or bootstrap dropdowns with a button in front of the list. The button is superfluous here, you need a solution based on the above html structure.
Found a solution, slightly correcting the solution from this question (you can find the answer in the comments)
Styling the ul like a dropdown?Anonymous
To place the code, please use CodePen or similar tool. Thanks you!