-2

I want to run a function when someone presses ctrl+c, irrespective of whether he did it while reading a Wikipedia article and trying to copy text, or while copying an URL from the address bar.

Also, if possible, could you tell me how I can pass the selected text to the function when the event is triggered.

Thanks a ton!

P.S. I hope It's possible to do everything using jQuery, along with it's plugins.

Pranay Prakash
  • 358
  • 4
  • 13
  • 1
    Please post some code you've tried to accomplish this. People aren't just going to create everything for you... – Mark Pieszak - Trilon.io Jul 30 '12 at 16:06
  • Welcome to Stackoverflow, @Pranay. This is a great community of developers who want to teach other developers. However, in order to do that, we want to see what it is you have attempted. Very rarely (except in the simplest of cases) will an answer be given to you directly. Can you please provide some code that you have already tried along with error messages, debugging, tests, etc. Doing these things will greatly increase your chances for a good answer. Thank you! – JasCav Jul 30 '12 at 16:10
  • Hey, guys I'm really sorry, and I know, I really should provide some code that I've used and all that, but unfortunately, in this case, I'm totally lost, and don't even know how to begin. That's why I asked out here. All I'm really hoping for, is if someone could tell me how I can start out, what plugins to use or something, and ill do the rest myself and post my results here, and then hope for a final solution. I really hope you can just help me start off, thanks. – Pranay Prakash Jul 30 '12 at 16:12

1 Answers1

0

In general this isn't possibly using jQuery, or even JavaScript running inside your browser. It would break the security model of the browser if you could access arbitrary events from the user's computer from some random web page.

For selecting text, see Selecting text in an element (akin to highlighting with your mouse)

Community
  • 1
  • 1
Jared
  • 521
  • 4
  • 8