CKTIS / HTML
ondblclick — handling a double-click
The ondblclick attribute contains JavaScript that handles the dblclick event, typically triggered by a double-click. It can be used on all HTML elements.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
ondblclick="JavaScript statements"ondblclick is an event handler content attribute for dblclick, available on all HTML elements. Its value is a JavaScript function body, not an event name or URL.
Inside the attribute code, event provides the event and this refers to the element handling it. The corresponding element.ondblclick property accepts a function or null, not source text. Assigning another function replaces that property's previous handler; addEventListener('dblclick', handler) registers independent listeners.
Content Security Policy can block attribute code. Do not insert untrusted text into it. Also provide an alternative to double-clicking in the interface rather than making an essential action depend on it.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>ondblclick demo</title>
<button type="button" ondblclick="this.textContent = 'Done'">Double-click me</button>
</html>Result
Done
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.