.copy()Returns: jQuery
Description: Copies element content to clipboard.
This function will copy the contents of an element.
Consider the following example:
1
2
3
4
5
6
7
|
|
The text "Some text to copy" will be copied to the clipboard. This process will work as if you selected the text manually and then copied by right-clicking or by using keyboard shortcuts. This will not invote a copying event listener, however.
The .copy()
function will work differently when copying a table:
1
2
3
4
5
6
7
8
9
10
11
12
|
|
In this case, the .copy()
function will copy the outer HTML of the table. The entire element is copied so it will retain all its table-loke properties when pasted into a spreadsheed editor, like Excel.