I need a way to copy to the clipboard in JavaScript?

For an web application that I'm working on, it is required to copy a text segment using JavaScript. Is it is possible to do this using JavaScript?


  • This can be achieved using a workaround since this is restricted in many browsers for a direct method. You can popup a copy box as follows.

    function copyToClipboard(text) {
      window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion