Open In App
Related Articles

How to run a code on double-click event in jQuery ?

Improve Article
Save Article
Like Article

In this article, we will see how to run a code after double clicked the element using jQuery. To run the code on double clicked we use dblclick() method. This method is used to trigger the double-click event to occur. This method occurs when the selected element will be double clicked.



Parameter: It accepts an optional parameter “args” which specifies a function that do a specific task after double clicking.



<!DOCTYpe html>
        How to run a code on double-click
        event in jQuery?
    <script src=
    <!-- jQuery code to show the working 
        of this method -->
        $(document).ready(function () {
            $("body").css("text-align", "center");
            $("h1").css("color", "green");
            $("p").dblclick(function () {
                $(this).css("font-size", "20px");
                $(this).css("color", "green");
        How to run a code on double-click
        event in jQuery?
        GeeksforGeeks: A computer science portal


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 17 Mar, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials