copiar, cortar y pegar eventos que no funcionan en Opera

Why jquery .bind() not working in opera for cut copy paste ¿eventos?

$(document).ready(function(){
  $('#txtInput').bind("cut copy paste",function(e) {
      e.preventDefault();
  });
});

preguntado el 27 de agosto de 11 a las 21:08

2 Respuestas

[Actualizar] Opera implemented the Clipboard API in version 12.10 as far as I can tell, although it has been implemented in their Rendering Engine for quite some time (Presto/2.10.292).

This issue is not related to jQuery's bind function but rather to the fact that Opera didn't support cut, copy and paste events before version 12.10.

Respondido 27 Feb 13, 01:02

Will thy support it in the future or is there any reasons they why they not supporting that yet? - Joper

It will be supported in the future, just hasn't been implemented yet. - Hallvors

@hallvors: Glad to hear it from the horse's mouth. Implementing the input event for contenteditable and the selectionchange event would be brilliant too. - Tim Down

@TimDown: yes, we know about those events being missing too ;) - Hallvors

For everyone reading this, the future has already happened. Opera implemented them with Presto 2.10 in April 2012 - Bergi

what about alternative?

  $('#txtArea').keydown( function(e){
      if(e.which==17 || e.which == 91) isCtrl=true;
      if(isCtrl) {
        switch(e.which) {
          case 67:  dostuff(); break; //ctrl c
          case 88:  dostuff(); break; //Ctrl x
          case 86:  dostuff(); break; //ctrl 
          default:  break;
        }
        e.preventDefault();
      }
    });

Respondido 28 ago 11, 02:08

is it possible to add there a line which would disable context menu call (right button click) - Joper

$("#element").bind("contextmenu", function(e) { e.preventDefault(); }); - génesis

There's no way to stop cut, copy and paste actions from the Edit menu. - Tim Down

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.