Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-30 18:22:35 +02:00
parent 9acb7dadc1
commit c08892459a
8 changed files with 12 additions and 11 deletions

View File

@ -10,7 +10,7 @@ Only works as a result of user action (i.e. inside a `click` event listener).
- Create a new `<textarea>` element, fill it with the supplied data and add it to the HTML document.
- Use `Selection.getRangeAt()`to store the selected range (if any).
- Use `Document.execCommand('copy')` to copy to the clipboard.
- Use `Document.execCommand()` to copy to the clipboard.
- Remove the `<textarea>` element from the HTML document.
- Finally, use `Selection.addRange()` to recover the original selected range (if any).
- **Note:** You can use the asynchronous [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API) in most current browsers. You can find out more about it in the [copyToClipboardAsync snippet](/js/s/copy-to-clipboard-async).