✂️ jQuery Clipboard plugin (newest version) - Copy any text to the user's clipboard. Implements ZeroClipboard over the jQuery plugin layer.
Switch branches/tags
Latest commit 3a32d90 Feb 8, 2016 @valeriansaliou Fix README
Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name>
Failed to load latest commit information.
test Fix tests Mar 18, 2015
.gitignore Fix tests Mar 18, 2015
.travis.yml Travis build May 22, 2015
Gruntfile.js Fix tests Mar 18, 2015
LICENSE.md License beautify Aug 20, 2013
README.md Fix README Feb 8, 2016
jquery.clipboard.js v1.4 Oct 3, 2014
jquery.clipboard.swf Hard update to latest jQuery Clipboard Mar 1, 2014
package.json Fix tests Mar 18, 2015


jQuery Clipboard

Build Status Gitter

jQuery Clipboard plugin: copy any text to the user's clipboard. Implements ZeroClipboard over the jQuery plugin layer.


1. Before You Start

  • Due to Flash restrictions, jQuery Clipboard cannot be used on local domains (localhost, .dev), you need to serve it from a genuine Internet domain (.com, .net or so)
  • Please check that you are using at least jQuery 1.7 - jQuery Clipboard won't work with versions below!

2. Include Scripts

<script type="text/javascript" src="/path/to/javascripts/jquery.js"></script>
<script type="text/javascript" src="/path/to/javascripts/jquery.clipboard.js"></script>

3. Apply On An Element

$(document).ready(function() {
    var copy_sel = $('.code-block a.code-copy');

    // Disables other default handlers on click (avoid issues)
    copy_sel.on('click', function(e) {

    // Apply clipboard click event
        path: '/path/to/flashes/jquery.clipboard.swf',

        copy: function() {
            var this_sel = $(this);

            // Hide "Copy" and show "Copied, copy again?" message in link

            // Return text in closest element (useful when you have multiple boxes that can be copied)
            return this_sel.closest('.code-block').text();

4. More Docs

More docs can be found on http://www.steamdev.com/zclip/

jQuery Clipboard is mostly based on jQuery.zClip, the plugin APIs remain almost the same.