JavaScript .dblclick()

BrandonDusch's avatar
Published Aug 4, 2022Updated Aug 4, 2022
Contribute to Docs

The .dblclick() method attaches an event handler to the "dblclick" event of an HTML element.

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours

Syntax

$(selector).dblclick(handler);

A handler function will be assigned to the "double-click" event of the HTML element(s) specified by selector.

Example

The following jQuery code will spawn a message box every time a paragraph in the document is double-clicked:

$("p").dblclick(function() {
alert("Paragraph double-clicked!");
});

All contributors

Contribute to Docs

Learn JavaScript on Codecademy

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours