I have a dropdown list made of <select>
and <option>
tags, with a function to bring up a confirmation box when a selection is made. A simple yes
/no
.
Clicking yes
will set the current state to the state chosen from the dropdown, whereas no
will of course not change the state.
However, when clicking no
, the dropdown list will remain highlighted on the state that we just declined changing to.
Is there a way in which I can get it to go back to the current state?
Here is my stackblitz to show what is going on
UPDATE
Some of the answers below have been good, but the one thing missing from them is that, if the state
is not assigned to a value, I do not get the disabled
option displayed.