Skip to content
Related Articles

Related Articles

How to display a message on dblclick event on all paragraphs of a page using jQuery ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 23 Apr, 2021

The purpose of this article is to display a message to the double click event on all paragraphs on a page. Whenever you double-click on any of the paragraphs then the message will appear.

Used method in jQuery: 

dblclick(): This method is used to trigger the dblclick event, or attaches a function to run when a double click event occurs.





  • First, create the HTML page with some paragraph elements.
  • Using the above syntax to display a message after the trigger of double-click event.



<!DOCTYPE html>
    <script src=
        body {
            text-align: center;
            font-size: 30px;
        $(document).ready(function () {
            $("p").dblclick(function () {
                    "The paragraph was double-clicked");
    <h2 style="color:green">GeeksforGeeks</h2>
        Double-Click on this paragraph 
        to see the result.
    <p>Second paragraph</p>
    <span>This is span</span>
    <p>Third paragraph</p>
    <div style="height:10px;"></div>
    <div id="result"></div>


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!