You get a bonus - 1 coin for daily activity. Now you have 1 coin

jquery disable the right mouse button

Practice



how do you disable the right mouse button with jquery?

if it's for the whole document, you can do it like this
$(document).ready(function() {
$("body").contextmenu(function(){
return false;
});
});

thanks, and how do you make it so the text can't be selected and copied?

jQuery.fn.extend({

disableSelection : function() {
this.each(function() {
this.onselectstart = function() { return false; };
this.unselectable = "on";
jQuery(this).css({
'-moz-user-select': 'none'
,'-o-user-select': 'none'
,'-khtml-user-select': 'none'
,'-webkit-user-select': 'none'
,'-ms-user-select': 'none'
,'user-select': 'none'
});
// For Opera
jQuery(this).bind('mousedown', function() {
return false;
});
});
}
});
jQuery(function(){
jQuery('body').disableSelection();
});

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone