HTML DOM UiEvent detail Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM UiEvent detail property returns a number corresponding to clicks triggered continuously.

NOTE: If ondblclick event is triggered returned value is ‘2’, and always ‘0’ if onmouseover or onmouseout event is triggered.

Following is the syntax −

Returning number of clicks triggered continuously −


Let us see an example of Event detail property −


 Live Demo

<!DOCTYPE html>
<title>HTML DOM UiEvent detail</title>
   form {
      margin: 0 auto;
      text-align: center;
   * {
      padding: 2px;
   input[type="button"] {
      border-radius: 10px;
   #playArea {
      display: inline-block;
      border-radius: 50%;
      background-color: #DC3545;
      width: 50px;
      height: 50px;
      border: 3px solid #AC3509;
   #clickOn {
      border: 3px solid #F0FF33;
      margin: 15px auto;
      border-radius: 50%;
      background-color: #FFF933;
      width: 10px;
      height: 10px;
   h2 {
      display: inline-block;
         <h2 id="highScore">High Score: 0</h2>
         <h2 id="currScore">Current Score: 0</h2><br>
         <div id="playArea"><div onclick="getHighScore(event)" id="clickOn"></div></div><br>
   var clickOn = document.getElementById("clickOn");
   var playDisplay = document.getElementById("playArea");
   var highScore = document.getElementById("highScore");
   var currScore = document.getElementById("currScore");
   var high = 0, score = 0;
   function getHighScore(event) {
      var score = event.detail;
      currScore.textContent = 'Current Score: '+score;
         if(score > high){
            highScore.textContent = 'High Score: '+score;
            high = score;


Before clicking the yellow div element −

After clicking the yellow div element continuously −

After clicking the yellow div element continuously but less than previous time −

Published on 30-Oct-2019 10:44:42