Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

textarea: button to trigger native undo/redo

Tags:

javascript

I have a textarea. It has default undo/redo functionality, either with ctrl-z/y or by right-clicking and choosing copy/paste.

I want to create an undo/redo button and trigger the native undo/redo. I'm not sure how to trigger this. (Was surprised that my users don't know ctrl-z)

like image 839
user984003 Avatar asked Aug 05 '13 09:08

user984003


1 Answers

You can use document.execCommand to achieve this functionallity. It is used by some HTML-editors.

execCommand compatibility

And by now, this is deprecated, and should not be used.

like image 129
NoLifeKing Avatar answered Nov 01 '22 06:11

NoLifeKing