เมื่อผู้ใช้คัดลอกเนื้อหาขององค์ประกอบ จากนั้น oncopy ทริกเกอร์เหตุการณ์
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีใช้งาน oncopy เหตุการณ์ใน JavaScript
<!DOCTYPE html>
<html>
<body>
<input type = "text" oncopy = "copyFunction()" value = "copy the text">
<script>
function copyFunction() {
document.write("Text copied!");
}
</script>
</body>
</html>