Skip to content
Copy to clipboard for modern browsers in less than 1kb.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix bug from reddit ( Jan 28, 2017
test rework the API Jan 28, 2017
.babelrc outset-lib Jan 27, 2017
.eslintrc outset-lib Jan 27, 2017


gotem on NPM Standard JavaScript Style

Copy to clipboard for modern browsers in less than 1kb.


$ npm i gotem --save


gotem is a function that accepts 3 parameters:

  1. A required trigger node.
  2. A required target node.
  3. An optional object of callback functions.

Examples follow:

import gotem from 'gotem'

// a trigger and target node are required
const nodes = {
  trigger: document.getElementById('trigger'),
  target: document.getElementById('target')

// when the trigger is clicked,
// the text of the target will be copied to the clipboard

// if an object with callback functions (success, error) is passed,
// the appropriate function, based on the result of executing the copy command, will be fired if it exists
gotem(nodes.trigger,, {
  success: () => console.log('Copy command succeeded'),
  error: () => console.log('Copy command failed, BUT the text to copy has still been selected.')

Browser Support

gotem requires execCommand cut/copy support.

As such, it works in the following:

  • Chrome 43+
  • Firefox 41+
  • Safari 10+
  • Edge 12+
  • IE 9+


MIT. © 2017 Michael Cavalea

You can’t perform that action at this time.