How it works

A modern approach to copy text to clipboard No Flash. No framevorks. Just 3kb gzipped https://clipboardjs.com/

Basic Example

Simply add the attribute data-clipboard-target an action button with the input element's id get it working. Then add the clipboard JS to initialize it.

Cut text from another element

Additionally, you can define a data-clipboard-action attribute to specify if you want to either copy or cut content.

If you omit this attribute, copy will be used by default.

Copy text from attribute

Truth is, you don't even need another element to copy its content from. You can just include a data-clipboard-text attribute in your trigger element.

<!-- Plugin Js -->
<script src="assets/bundles/clipboard.bundle.js"></script>

<!-- Jquery Page Js -->
<script>
	new ClipboardJS('.btn');
</script>