there is a dropdown with 5 options. Currently,option 2 is selected.The user selects option 4 now.The onchange event gets fired which is caught in a JS function listening for onchange on the select.
In the JS function, I can check easily the index of the option selected by the user using the selectedIndex property.However, I want to also know what was the original value that the user changed it from.
Is there a property that persists
basically the original value i.e.
option 2 in this case.
Just as a concept I put together the following – there may very well be a better way to do this:
—
Closed-up Example:
I’ve tried to tie this all into the actual drop-down element itself. In all honesty, this is the first time I’ve ever add functions to the dropdown itself, so I cannot promise that this won’t have consequences: