How to get old Value with onchange() event in text box

后端 未结 9 2343
一向
一向 2020-11-28 05:49

I have a text Box and a Value poplulated in it when page loads. Now If user chanegs any thing in text box, then I want to get the Changed Value(New Value) and Old Value but

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 06:23

    element.defaultValue will give you the original value.

    Please note that this only works on the initial value.

    If you are needing this to persist the "old" value every time it changes, an expando property or similar method will meet your needs

提交回复
热议问题