I need a way to copy to the clipboard in JavaScript? - Programmers Heaven

Howdy, Stranger!

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

Categories

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

danielm77danielm77 USAPosts: 72Member

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?

Tagged:

Comments

  • DavidMDavidM USAPosts: 342Member

    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.