Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>ZeroClipboard Starter Snippet - JSBin</title>
  <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" media="all" />
  <script src="//code.jquery.com/jquery-2.1.0.js"></script>
  <script src="//rawgit.com/JamesMGreene/sandblaster/master/dist/sandblaster.min.js"></script>
  <script src="//rawgit.com/zeroclipboard/zeroclipboard/master/dist/ZeroClipboard.min.js"></script>
</head>
<body>
<div id="warning"></div>
<button
  class="clipboard fa fa-copy"
  data-clipboard-text="Copied Button 1 Text"
  title="Copy button 1 text"></button>
<button
  class="clipboard fa fa-copy"
  data-clipboard-text="Copied Button 2 Text"
  title="Copy button 2 text"></button>
<div id="zcState">
    <h3>ZeroClipboard state: <button
  class="zc-state-updater fa fa-refresh"
  title="Refresh state"></button></h3>
    <pre></pre>
</div>
<div>
    <h3>Logs:</h3>
    <ul id="logger"></ul>
</div>
</body>
</html>
 
//
// Utility code
//
function showActive(el) {
    var $el = $(el);
    $el.fadeOut(10, function() { $el.fadeIn(90); });
}
var $logger = $("#logger");
function log(msg) {
    $logger.prepend("<li>" + msg + "</li>");
}
//
// Forcibly remove the JSBin iframe sandboxing with Sandblaster.js
// https://github.com/JamesMGreene/sandblaster
//
var result = sandblaster.detect();
if (result.framed && result.crossOrigin !== false && result.sandboxed !== false) {
    $("#warning").html('<p><strong>IMPORTANT:</strong> This JSBin can only work correctly if visiting the result view in the top frame!</p><p>Paste this URL into your browser\'s address bar: <a href="' + window.location.href + '">' + window.location.href + '</a></p>').after("<hr />");
}
else if (result.sandboxed && sandblaster.unsandbox()) {
    sandblaster.reload();
}
//
// Begin ZeroClipboard stuff
//
ZeroClipboard.config({
    forceHandCursor: true
});
var client = new ZeroClipboard($("button[data-clipboard-text]"));
client.on("error", function(e) {
    log("ERROR! [" + e.name + "] " + e.message);
});
client.on("copy", function(event) {
    var clipboard = event.clipboardData;
        clipboard.setData( "text/plain", event.target.innerHTML + " <-- added this text!" );
});
client.on("ready", function(e) {
    log("Ready!");
    client.on("aftercopy", function(e) {
        log((e.success["text/plain"] ? "Copied" : "FAILED to copy") + ": " + e.data["text/plain"]);
        showActive(e.target);
    });
});
$(".zc-state-updater").on("click", function() {
  $("#zcState pre").text(JSON.stringify(ZeroClipboard.state(), null, 2));
});
$("#zcState pre").text(JSON.stringify(ZeroClipboard.state(), null, 2));
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers