简体   繁体   中英

How I use multiply(*), add(+) divide (/) to be hotkey (shortcut key)

I want to make "add(+)" "multiply(*)" "divide(/)" as hotkeys but following the code I attached they can not do for that

 $(document).keypress(function(event) { var keycode = (event.keyCode? event.keyCode: event.which); if (keycode == '111') { $('#someTextBox').focus(); } });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="text" id="someTextBox" />

http://www.asquare.net/javascript/tests/KeyCode.html does not show 111 as a one of +,/,* on keypress

 $(document).keypress(function(event) { var keycode = (event.keyCode? event.keyCode: event.which); $('#someTextBox').val(keycode) if ([42,43,47].indexOf(keycode) > -1) { $('#someTextBox').focus(); } });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="text" id="someTextBox" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM