i need i nice solution to manage the left-& rightclick on a div with a special class (live).
It is important for me that the code works on every new browser.
Hope somebody can help me.
My first try ... // the rightclick does not work
HTML
<div id="test_one" class="my_class">Click here</div>
<br /><br />
<div id="test_two" class="my_class">Click here</div>
JS
$(document).ready(function test()
{
$(".my_class").bind("contextmenu",function(e){ return false; });
$(".my_class").live('click', function(e)
{
if(e.button == 0 || e.button == 1)
{
alert('L -> '+this.id+'');
}
else if(e.button == 2){
alert('R -> '+this.id+'');
}
});
});
example: http://jsfiddle.net/EWXse/
Thanks in advance! Peter