jQuery Disable Right Mouse Click

Sam Deering

jQuery Code Snippet to disable the mouse right click as often used with websites who want to add some low level security. jQuery can do this with a bind to the contextmenu event. I reccommend only using this function if you have to as it is generally bad practice.

$(function() {
	$(this).bind("contextmenu", function(e) {
		e.preventDefault();
	});
}); 

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Pete Sake

    good job! thanks!

  • skoda

    Thank you so much Sam…..