How to handle undo/redo event in javascript?

前端 未结 6 1964
时光取名叫无心
时光取名叫无心 2020-12-10 08:42

I\'m trying to detect whenever a form input\'s value changes using Javascript & JQuery. Unfortunately, I find JQuery\'s $(elem).change() insufficient becaus

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 09:25

    I created a state undo/redo snapshot manager class, which would be great for tracking the change history on an entire HTML element with child inputs. If you want to take snapshots on a more granular level, you can bind on keypress events instead of the change events I used in my example.

      










    See this JSFiddle: https://jsfiddle.net/up73q4t0/56/

提交回复
热议问题