(These are demos for the code examples in Matt’s HTML5 Rocks post.)

Demo 1: Copy email address via button click

Note: You don’t need to select anything. Just click the “Copy” button.

“Email me at matt@example.co.uk


Demo 2: Cut <textarea> value via button click

Note: Again, no need to select anything. Just click the button.


Don’t forget to paste somewhere to confirm that the document.execCommand() operations have successfully populated the clipboard.


Browser support: