4

I'm trying to do very simple thing: when user changes the value of the dropdown list I'd like to display the confirmation. I've tried doing this:

change: function () {
    return confirm("Czy chcesz zapisać tę zmianę?");
}

and the same thing using e.preventDefault() but the value still gets updated.

Any ideas how can I do this?

Lukasz Lysik
  • 10,462
  • 3
  • 51
  • 72

1 Answers1

6

Use the select event instead. Select happens before the change, and change happens after the value has already been changed.

Example here.

CodingWithSpike
  • 42,906
  • 18
  • 101
  • 138