简体   繁体   中英

Implement ctrl+x's behaviour same as ctrl+c without use of Flash

In my web application, I need a shortcut ctrl+x to hate the same behavior as ctrl+c when some text in

paragraph is selected (selection is not in textarea or text input). I need solution without use of Flash.

First of all you have to prevent the default action on the cut-event. You can do this the following code:

$(document).ready(function(){
      $('#input').live("cut",function(e) {
             e.preventDefault();

      });
    });

Most browsers prevent control of the clipboard. Although I know the following jQuery-plugin exists that gives you a bit of control of it: zeroclipboard

Note: You must use the Flash add-in you do not want to use to automatically copy text to the client's clipboard. A website automatically modifying the client's clipboard without the aid of active-x components is a security concern.

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