Copies a string to the clipboard. Must be called from within an event handler such as click. May return false if it failed, but this is not always possible. Browser support for Chrome 43+, Firefox 42+, Safari 10+, Edge and Internet Explorer 10+.
Parameters:
Name | Type | Description |
---|---|---|
text | string | The text to copy to the clipboard. |
- Since
- 1.0.0
- Source
Returns:
Returns the methods applying the copy or false if it failed.
- Type:
- boolean |
*
Example
import { clipboard } from "@gravityforms/utils";
function Example() {
const shortcode = `[gravityform id="${ this.options.data.form_id }" title="true"]`;
clipboard( shortcode );
}