3

I want to catch the paste event with right Click and Paste selection on a textarea. What I did is:

$(window).bind('paste', function(event) {                  
    pasteText();  
    return false;              
 });

and it works ok. So when the Paste is clicked a small popup window is shown. What I want is to make this popup window shown on mousedown event. I mean when I click the Paste (mousedown) then I want to see the popup. Is this possible to happen?

Thanks in advance

novellino
  • 1,069
  • 4
  • 22
  • 51

1 Answers1

1

You can't catch the mousedown event on the context menu (as one could prevent save as, view source, etc functions)...so the browsers really don't fire an event there.

Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
  • So do you have any idea of how can I do something like this, or is something I just can't do? – novellino Dec 07 '10 at 10:20
  • @novellino - It's not something you can do...there's just no event there (imagine the popup interrupting your paste, see how annoying it could be?) You could store the value *before* the `paste` event, and revert it if needed, would that accomplish what you're after? – Nick Craver Dec 07 '10 at 10:23
  • Ok that would be perfect but the problem is I can not store my value before the paste somewhere. I don't know how to do this. Any ideas? – novellino Dec 07 '10 at 12:33
  • @novellino - just store the `.val()` result whenever it changes, e.g. a `.change()` handler...use that value for that it was previously, before the paste event. – Nick Craver Dec 07 '10 at 12:34