Luis Gallego Luis Gallego - 1 year ago 86
HTML Question

How to copy a div's content to clipboard without flash

That's it :) I have a div with the id #toCopy, and a button with the id #copy.
What's the best way to copy #toCopy content to clipboard when pressing #copy?

Answer Source

UPDATED ANSWER Javascript was restricted from using the clipboard, early on. but nowadays it supports copy/paste commands. See documentation of mozilla and


make sure that you support browsers that don't.

Javascript is not allowed to use the clipboard, but other plugins like flash do have access.

How do I copy to the clipboard in JavaScript?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download