Reputation: 67
I place the text on the image inside the label. If I drag the text and place it in a text box it automatically copies that text. But i don't want that to be happened. Please give me a hint to disable the mouse click and drag event on the text.
Upvotes: 1
Views: 3072
Reputation: 12959
this help you :
<html>
<head>
</head>
<body>
<span id="txt" draggable="false">This is test</span>
<script>
var txt = document.getElementById("txt");
txt.addEventListener("click",function(event){event.preventDefault();})
txt.addEventListener("mousedown",function(event){event.preventDefault();})
txt.addEventListener("mouseup",function(event){event.preventDefault();})
txt.addEventListener("contextmenu",function(event){event.preventDefault();})
</script>
</body>
</html>
Upvotes: 6