เมื่อผู้ใช้ตัดข้อความขององค์ประกอบ oncut ทริกเกอร์แอตทริบิวต์ใน HTML
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน oncut แอตทริบิวต์ −
<!DOCTYPE html>
<html>
<body>
<input type = "text" oncut = "display()" value = "Cut me">
<h2 id = "test">Try to cut the above text.</h2>
<script>
function display() {
document.getElementById("test").innerHTML = "Your cut text worked!";
}
</script>
</body>
</html>