I have provided two separates button for Ctrl+z and Ctrl+y. I want the Ctrl+z and Ctrl+y functionality to be performed on the click of a button.
To achieve this, I am trying to trigger Ctrl+z and Ctrl+y on button click but they are not getting triggered.
The code I have written so far:
case "undo":
var press = jQuery.Event("onkeydown");
press.ctrlKey = true;
press.keyCode = 90;
jQuery(".excellentableEditSpread").trigger(press);
break;
case "redo":
var press = jQuery.Event("onkeydown");
press.ctrlKey = true;
press.keyCode = 89;
jQuery(".excellentableEditSpread").trigger(press);
break;
You can try this:
function doUndo(){
document.execCommand('undo', false, null);
}
function doRedo(){
document.execCommand('redo', false, null);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With