Your Search Results


    The ondblclick property returns the onDblClick event handler code on the current element.


    element.ondblclick = function;
    • function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as
    element.ondblclick = function() { alert("ondblclick event detected!"); };


    <title>ondblclick event example</title>
    <script type="text/javascript">
    function initElement()
     var p = document.getElementById("foo");
     // NOTE: showAlert(); or showAlert(param); will NOT work here.
     // Must be a reference to a function name, not a function call.
     p.ondblclick = showAlert;
    function showAlert()
     alert("ondblclick Event detected!")
    <style type="text/css">
    #foo {
    border: solid blue 2px;
    <body onload="initElement()">
    <span id="foo">My Event Element</span>
    <p>double-click on the above element.</p>


    The dblclick event is raised when the user double clicks an element.


    DOM Level 0. Not part of specification.

    Document Tags and Contributors

    Last updated by: teoli,
    Hide Sidebar