Skip to content Skip to sidebar Skip to footer

Modify Undo/redo Behaviour On A Textarea Using Jquery

I need to handle the events undo and redo myself when a user selects undo/redo from context menu or presses ctrl z in a textarea. How can i prevent the default behavior and add cu

Solution 1:

You can detect ctrl+z on keyup() with:

var ctrlZ = e.ctrlKey && e.which === 90
if (ctrlZ) { ... } 

And context menu on mousedown() with:

var rightClick = e.which === 2
if (rightClick) { ... }

Post a Comment for "Modify Undo/redo Behaviour On A Textarea Using Jquery"