Clipboard.Js

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

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

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

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.