Skip to content
Advertisement

How to get the previous selected value from a dropdown before onchange

I know its the easiest question but can’t get the correct answer.

JavaScript

This is my onchange function. In this How Can I get the previous Selected Value from my select box?

JavaScript

Advertisement

Answer

Save the original value using data() when the element gets focus:

JavaScript

And then get the saved old value in your onchange function:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement