jQuery event.type Property

Introduction

Return which event type was triggered:

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*from   w w  w .  j a va  2 s  .  c om*/
<script>
$(document).ready(function(){
  $("p").on("click dblclick mouseover mouseout",function(event){
    $("div").html("Event: " + event.type);
  });
});
</script>
</head>
<body>

<p>This paragraph has a click, double-click, mouseover and mouseout event defined.
<div />

</body>
</html>

The event.type property returns which event type was triggered.

event.type
Parameter Optional Description
event Required.The event parameter comes from the event binding function



PreviousNext

Related