Title | Added | Status | Last reviewed |
---|---|---|---|
Clipboard service |
v3.2.0 |
Active |
2019-04-12 |
Copies text to the clipboard.
- copyContentToClipboard(content:
string
, message:string
)
Copies a text string to the clipboard.- content:
string
- Text to copy - message:
string
- Snackbar message to alert when copying happens
- content:
- copyToClipboard(target:
HTMLInputElement
|
HTMLTextAreaElement
, message?:string
)
Copies text from an HTML element to the clipboard.- target:
HTMLInputElement
|
HTMLTextAreaElement
- HTML element to be copied - message:
string
- (Optional) Snackbar message to alert when copying happens
- target:
- isTargetValid(target:
HTMLInputElement
|
HTMLTextAreaElement
):boolean
Checks if the target element can have its text copied.- target:
HTMLInputElement
|
HTMLTextAreaElement
- Target HTML element - Returns
boolean
- True if the text can be copied, false otherwise
- target:
Use copyContentToClipboard
to copy a text string or isTargetValid
and
copyToClipboard
to copy the content of an HTML element in the page. The
message
parameter specifies a snackbar message to alert the user when the
copying operation takes place.