HTML DOM Clipboard event is used to provide information about clipboard modifications. Events can be cut, copy and paste. Clipboard events can be used to make your website more accessible by providing users with information about how the clipboard has been modified.
The following are the properties of the Clipboard event−
Description | |
---|---|
Returns an object containing the data affected by the clipboard operation (cut, copy, or paste). |
Description | |
---|---|
This event is triggered when the user copies the content of an element. | |
This event is triggered when the user cuts the content of the element. | |
This event is triggered when the user pastes some content in the element. |
var clipboardEvent = new ClipboardEvent(type,[options]);
<!DOCTYPE html> <html> <body> <form> <label> TEXTBOX <input type="text" oncopy="CopyText()" value="Copy this text"> </label> </form> <p id="Sample"></p> <script> function CopyText() { document.getElementById("Sample").innerHTML = "The text has been copied by you!" } </script> </body> </html>
<label> TEXTBOX <input type="text" oncopy="CopyText()" value="Copy this text">
element using the getElementById() method on the document and displays "You have copied the text!" inside the paragraph.
function CopyText() { document.getElementById("Sample").innerHTML = "The text has been copied by you!" }
The above is the detailed content of HTML DOM Clipboard event. For more information, please follow other related articles on the PHP Chinese website!