Skip to content Skip to sidebar Skip to footer

Copying Textarea Text Regardless Of Browser

I'm trying to do something that I originally thought would be quite simple, but it's turning out not to be. Mainly I'm trying to have so I can have a textarea on a page, with a but

Solution 1:

This is possible, but isn't consistent across browsers. You can use the jQuery plugin Clipboard as a substitute.

This plugin uses a Flash object internally to copy to the clipboard, which should be consistent across browsers.

With the plugin included, the following code should work:

var text = $("textarea").text();
$.clipboard(text);

That will copy everything in the text area to the clipboard.

Post a Comment for "Copying Textarea Text Regardless Of Browser"