This is my sample code:
html
<div> This is the Phone and NO ONE SHOULD RIGHT CLICK THIS! >:) </br> <img class="tlClogo" src="http://i.imgur.com/0atiS5C.jpg" style="height: 120px; width:120px;"> </div></br></br></br></br> And this is the Keyboard, ofcourse yo can right click this :)</br> <img src="http://i.imgur.com/xkrKz1X.jpg" style="height: 120px; width:120px;">
js
$('img').bind('contextmenu', function(e){ alert("This Logo is protected");return false; });
fiddle
I want no one to be able to right click the 1st picture (cellphone) but other than that(keyboard) should be able to right click.
PS: I know this can be overriden by browsers but its okay :)
Came up with a solution.
$('.tlClogo').bind('contextmenu', function(e) { return false; });
Fiddle: http://jsfiddle.net/79k52rvu/4/
EDIT 1: Only the first one is now NOT right-clickable!
<html> <body> <div> This is the Phone and NO ONE SHOULD RIGHT CLICK THIS! >:) </br> <img class="tlClogo" src="http://i.imgur.com/0atiS5C.jpg" style="height: 120px; width:120px;"> </div> </br></br></br></br> And this is the Keyboard, ofcourse yo can right click this :)</br> <img src="http://i.imgur.com/xkrKz1X.jpg" style="height: 120px; width:120px;"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $('.tlClogo').bind('contextmenu', function(e) { return false; }); </script> </body> </html>
EDIT 2: Provided an HTML-doc