So I have a <div contenteditable>. I implement buttons for undo and redo:
<button onclick="undo(event)">
<button onclick="redo(event)">
function undo(event) {
event.preventDefault();
document.execCommand('undo', false, null);
}
function redo(event) {
event.preventDefault();
document.execCommand('redo', false, null);
}
I need to set disable for undo or redo button depending on the input history. How can I check if undo or redo available?