Detect cut copy or paste events Using Jquery
<
html
>
<
head
>
<
script
type
=
"text/javascript"
src
=
"http://code.jquery.com/jquery-1.10.2.min.js"
></
script
>
<
style
type
=
"text/css"
>
span{
color:green;
font-weight:bold;
}
</
style
>
</
head
>
<
body
>
<
h1
>Detect Cut, Copy and Paste with jQuery</
h1
>
<
form
action
=
"#"
>
<
label
>Text Box : </
label
>
<
input
id
=
"textA"
type
=
"text"
size
=
"50"
value
=
"Copy, paste or cut any text here"
/>
</
form
>
<
span
id
=
"message"
></
span
>
<
script
type
=
"text/javascript"
>
$(document).ready(function() {
$("#textA").bind({
copy : function(){
$('#message').text('copy behaviour detected!');
},
paste : function(){
$('#message').text('paste behaviour detected!');
},
cut : function(){
$('#message').text('cut behaviour detected!');
}
});
});
</
script
>
</
body
>
</
html
>
0 comments:
Post a Comment