English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery dblclick() method

jQuery Events

The dblclick() method triggers the dblclick event, or attach a function to be executed when the dblclick event occurs.

When a user double-clicks an element, a dblclick event occurs.

Syntax:

Trigger the dblclick event of the selected element:

$(selector).dblclick()

Attach the function to the dblclick event:

$(selector).dblclick(function)

Example

Trigger the dblclick event of the <p> element:

$(document).ready(function(){
  $("p").dblclick();
});
Test to see‹/›

Attach the function to the dblclick event (the dblclick event occurs when the user double-clicks an element):

$("p").dblclick(function(){
  $(this).css({"background-"color":"#007FFF","color":"white"});
});
Test to see‹/›

Hide the paragraph on the page when double-clicked:

$("p").dblclick(function(){
  $(this).slideUp();
});
Test to see‹/›

Parameter Value

ParametersDescription
functionFunction executed when the dblclick event is triggered each time

jQuery Events