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