jQuery.cut()Returns: Boolean
Description: Cuts selected text to clipboard.
-
version added: v0.1.1jQuery.cut()
-
This method does not accept any arguments.
-
This is functionally identical to using document.execCommand
or simply pressing Ctrl + X, but with some extra featured in case document.execCommand fails. Upon a successful execution, this function will return true
.
Consider the following example:
1
2
3
4
5
6
7
|
|
The text field &endash; <input>
&endash; will be selected. From there, we can call the copy function.
1
|
|
Any text that was inputed into the text field will be cut to the clipboard. This process will work as if you cut the text by right-clicking or by using keyboard shortcuts, but will not invote a cuting or copying event listener.