Microsoft Dot Net Master

Microsoft Dot Net Master
Microsoft Dot Net Master

Monday, April 22, 2013

jQuery Disable Cut Copy Paste Options in Textbox


To disable cut, copy and paste functionality for the Textbox we need to write the code like as shown below


<script type="text/javascript">
$(function() {
$('#txtName').bind("cut copy paste"function(e) {
e.preventDefault();
});
});
</script>
If you want to see it in complete example write the code like as shown below


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Disable Cut, Copy and Paste Options in textbox using jQuery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
$('#txtName').bind("cut copy paste"function(e) {
e.preventDefault();
});
});
</script>
</head>
<body>
<div>
<input type="text" id="txtName" />
</div>
</body>
</html>

No comments:

Post a Comment