This example demonstrates use of the window.dataTransfer.clearData method to clear the clipboard.
In this example, the string "This text should be cleared" is passed in the setData method. The clearData method clears it. It also clears the text being dragged so that it does not appear in the DIV upon completion of the data transfer operation.
Drag the green text and drop it over the magenta DIV.
Drop the text below. No text will appear when the clearData method is successfully invoked.
© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.