Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.36 KB

README.md

File metadata and controls

48 lines (32 loc) · 1.36 KB

lighty-clipboard.js

lighty-clipboard.js is a plain JavaScript library allowing its user to easily copy or cut text.

Usage

Copy / cut from element

On btn click, input's text will be copied to the clipboard.

new LightyClipboard({
    copy_trigger: btn,
    copy_target: "input.copy-mail",
    cut: true
});
  • [ DOMElement | SelectorString ] copy_trigger - The querySelector string or the element which will trigger the action.
  • [ DOMElement | SelectorString ] copy_target - The querySelector string or the element which contains the text input.
  • boolean cut - Allow cutting option.

Note : cut is optional and can be ignored or set to false.

Copy from string

On btn click, input's text will be copied to the clipboard.

new LightyClipboard({
   copy_trigger: btn,
   copy_data: "This string will be copied."
});
  • string copy_data - A string to be copied.

Note : when copying from an existing string, the cut property must be set to false or ignored.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Author

Alexis Philip (Website, GitHub, LinkedIn).