Initializes a component that copies the text of the element corresponding to the selector specified in the data-clipboard-target attribute to the clipboard.
The actual process for copying text to the clipboard is handled by clipboard.js.
Reference
Parameters:
context: string|HTMLElement|JQuery
A button element with a "data-clipboard-target" attribute that initiates a clipboard copy, or a context element or selector with such an element.
delay: number
Time (in milliseconds) to switch from the copy complete icon to the pre-copy icon. Default is 3000.
Basic
Set the data-clipboard-target attribute of the action button to the element ID you wish to copy and initialize it with the clipboard function.
import {components} from 'metronic-extension';
// Initialize the component and set up event listeners.
components.initClipboard(document.getElementById('button'));
Batch initialization
The clipboards of multiple action buttons can be initialized at once.
In that case, initialize the parent element of the action button that has the data-clipboard-target attribute with the clipboard function.
import {components} from 'metronic-extension';
// Initialize the component and set up event listeners.
components.initClipboard(document.getElementById('wrapper'));