I want to create a custom backspace button with the same logic as the backspace button on the keyboard. I am using the following code:
function backSpace() { var e = jQuery.Event("keyup"); e.which = 8;
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="styles.css" type="text/css" media="screen" /> <script src="formulas.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.js"></script> <meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=no"/> </head> <button onclick="backSpace()">backSpace</button> <body id="main" spellcheck="false"> <div id = "mainDiv" contenteditable="true"></div> </body> </html>
But that will not work. I do not understand what I am doing wrong. I spend a lot of time on this problem, but I have not solved it yet. Help me please.
source share