Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clipboard-dom

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clipboard-dom

Copy-to-Clipboard on a DOM element

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

clipboard-dom

Makes a DOM element (i.e. <button>) write to the system clipboard

Installation

$ component install component/clipboard-dom

Example

var Clip = require('clipboard-dom');

// set the path to the swf file first
Clip.swf('/swf/ZeroClipboard.swf');

// create a "Clip" instance
var ele = document.getElementById('copy-button');
var parent = ele.parentNode; // parent should "have layout"
var clip = new Clip(ele, parent);

// listen for meaningful events
clip.on('load', function(){
  console.log('button loaded');
});

clip.on('completed', function(text){
  console.log('copied text to the clipboard:', text);
});

clip.on('mousedown', function() {
  // "mousedown" is the last chance to set the text before it gets copied
  var input = document.getElementById('copy-text');
  clip.text(input.value);
});

Events

"load"

Fired when the SWF movie for the clipboard instance has loaded.

"complete"

Fired when the user clicks on the button and the text has been copied. The text that got copied is passed in as an argument.

"mouseover"

Fired when the user mouses over the button.

"mouseout"

Fired when the user mouses away from the button.

"mousedown"

Fired when the user pressed the mouse down on the button.

"mouseup"

Fired when the user releases the mouse from the button.

Keywords

FAQs

Package last updated on 04 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc