jQuery event.which get event parameter

Description

jQuery event.which get event parameter

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*w w w  .  j a va 2s  . c om*/
<script>
$(document).ready(function(){
  $("div").mousedown(function(event){
       $("div").append("<br>Mouse button pressed: " + event.which);
  });
});
</script>
</head>
<body>

<div style="border:1px solid black;width:400px;height:400px;">
Press down any mouse buttons inside this div element.</div>

</body>
</html>



PreviousNext

Related