jquery dblclick() method


  Translation results:

dblclick

UK [dblk'lɪk] US [dblk'lɪk]

Double-click, double-click (mouse)

jquery dblclick() methodsyntax

Function:When an element is double-clicked, the dblclick event occurs. A click occurs when the mouse pointer is over an element and the left mouse button is pressed and released. If two clicks occur within a short period of time, it is a double click event. The dblclick() method triggers the dblclick event, or specifies a function to run when the dblclick event occurs. Tip: Problems may arise if dblclick and click events are applied to the same element.

Trigger dbclick event syntax: $(selector).dblclick()

Bind the function to the dbclick event syntax: $ (selector).dblclick(function)

Parameters:

##ParametersDescriptionfunction Optional. Specifies the function to run when the dblclick event occurs.

jquery dblclick() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").dblclick(function(){
    $("p").slideToggle();
  });
});
</script>
</head>
<body>
<p>这是一个段落。</p>
<button>请双击此处</button>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance