<textarea></textarea> <button id="zzz">ctrl+Z</button> <button id="yyy">ctrl+Y</button> <script> zzz.onclick = e => document.execCommand('undo'); yyy.onclick = e => document.execCommand('redo'); </script>