Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/schmod/jclipboard

A jQuery plugin that allows rich text to be copied to the clipboard. (Uses Flash)
https://github.com/schmod/jclipboard

Last synced: about 2 months ago
JSON representation

A jQuery plugin that allows rich text to be copied to the clipboard. (Uses Flash)

Awesome Lists containing this project

README

        

jClipboard
==========
Copy text to your clipboard with jQuery
---------------------------------------

jClipboard is a small jQuery plugin that allows you to copy rich text to the system clipboard. jClipboard is loosely based around [jClip](http://www.steamdev.com/zclip/) and [Zero Clipboard](http://www.steamdev.com/zclip/), but weighs much less, thanks to the delegation of much of the heavy lifting to jQuery. Unlike other solutions that work with rich text, jClipboard also provides the system clipboard with a text-only rendition of your content for applications that cannot accept HTML.

Requires Flash 10. Sorry.

###Installation
[Download jClipboard](https://github.com/schmod/jClipboard/tarball/master), extract somewhere into your site, and include jQuery and jClipboard in your page


###Usage

Activate jClipboard on the element that you'd like to use as your copy button.
````javascript
$('a.copy').jclip({
path:'js/jClip10.swf',
copy:function(){
return $('textarea#myText').val();
}
)};
````

We accept some other parameters too. Here's a full list:

* `path`: Path to the jClipboard .SWF file. Defaults to `js/jClip10.swf`
* `copy`: Tells jClip what text or elements to copy. Accepts strings, jQuery objects, DOM Elements, and functions.
* `success`: Callback function executed after text has been copied. Accepts one parameter containing the text that was copied.
* `setHandCursor`: Set to `false` if you do not wish to use a pointer cursor over your copy button. Defaults to `true`.