Reputation: 280
I'm working on a contenteditable
div and trying to create a text editor, but in this text editor I'm adding some elements like image
and div
. If I'm supposed to add and remove elements in editable div and then hit CtrlZ undo function is not working (not getting element back).
Please let me know is there any solution for this. Undo function is only working for text inside the contenteditable
div. Thanks in advance.
Upvotes: 0
Views: 2340
Reputation: 709
You can use document.execCommand
for undo and redo the changes in the editable div's. You can refer this document for more details execCommand
Upvotes: 1