Method : 1
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});
Method : 2
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
e.preventDefault();
});
});
Disable Enter key on page using jQuery
$("#form").keypress(function(e) {
if (e.which == 13) {
return false;
}
});
Disable Cut,Copy and Paste functions for textbox using jQuery
$(document).ready(function(){
$('#txtInput').bind("cut copy paste",function(e) {
e.preventDefault();
});
});
Note :
Generally why we are using
preventDefault is, it will stop the default behavior of its eventand thus the default action (of showing context menu) is stopped here.
Thanks
No comments:
Post a Comment