Ondblclick Event in Javascript

Ondblclick Event in Javascript

Sometimes, we might want to react to the double click by the user. In such situations, we can make use of the Ondblclick attribute for that particular element. Now, we are going to have a look at the dblclick event, and we are going to handle it as well.

The below program is a demonstration of the same event.


As you can see, in the above program, there is a div element, and we have given some background color, some height, and some width to the div, and also, we have used the Ondblclick attribute, which is there for the double click event. So, if we double click on this element, the DoubleClick function would execute, which is written down there.

So, you can try doing the above program, just double click on the div, and observe the output. We are not doing much for the double click. We are just going to show some alerts. You can do a lot according to what the requirement says.