<!DOCTYPE html>
<html>
<head>
<title>Examine Mouse Event In Jquery</title>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button>press any mouse or keyboard button to get ascii value</button>
<script>
$(document).ready(function(){
$("button").mouseup(function(eventt){
document.oncontextmenu=function(){return false;}
switch(eventt.which)
{
case 1: alert('left');
break;
case 2: alert('middle');
break;
case 3: alert('right');
break;
default : alert('invalid button');
}
});
$(document).keydown(function(event){
alert(event.which);
});
});
</script>
</body>
</html>