Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- reomve text ('_copy') from focused input on keypress (CTRL + Q)
- */
- function stripFocus(text){
- const input = document.activeElement;
- var inputText = input.value;
- var re = new RegExp(text, 'g');
- inputText = inputText.replace(re, '');
- input.value = inputText;
- }
- document.onkeydown = function(evt) {
- evt = evt || window.event;
- if (evt.ctrlKey && evt.keyCode == 69) {
- stripFocus('_copy');
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement