yensdesign – Tutorials, Web Design and Coding

Daily free tutorials about web design, coding, jquery and more

Posts Tagged ‘cancel’

Fast Tip: How to cancel right click context menu in jQuery

Friday, December 12th, 2008

Hi there guys! While I was working in the next tutorial I have been encountered with a problem: How can I block / cancel the context menu when I do right click on the screen?

There are a lot of examples and scripts in javascript, but one more time jQuery makes it easy! Here you have the code:

[code language="javascript"]
$(document).ready(function(){
	$(document).bind("contextmenu",function(e){
		return false;
	});
});
[/code]

This code works in: Firefox, Internet Explorer 6 & 7, Opera, Safari & Chrome.

One more thing guys… the next tutorial will be released on next Monday as a part of serie of tutorials that will be very very BIG, interesting and useful :)

See you soon!