Follow in Twitter & Facebook

Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools

Friday, August 24, 2012

Disable right click by using jQuery in

In this article we will discuss how we can disable right click using jQuery. You can also check my laste article on how to open hyperlink in new tab window using jQuery here.

In most of the pages sometime we required to disable right click option. We can do it easiy using jQuery. Below is the code:
.aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisableRightClick.aspx.cs"
Inherits="DisableRightClick" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
<script type="text/javascript" src=""></script>
<title>Disable right click using jquery in</title>

<script type="text/javascript" language="javascript">
$(function () {
$(this).bind("contextmenu", function () {
return false

<form id="form1" runat="server">
<div>Warning: Right click is disabled so do not try !!!

In the above code 2 things are important first is the jQuery function and 2nd one is the jQuery library reference.
You can also check some SQl Server articles and interview questions.

0 on: "Disable right click by using jQuery in"