Monday, September 26, 2011

JQuery Double Click Event

In this article we will learn how JQuery double click events work

Example 1: Show Alert on double click of paragraph, using JQuery Event (Live Demo)
I have a simple html para, whose id is "MyPara" on double click of this paragraph it should display alert.

<p id="MyPara" style="background-color:Yellow;color:Red;font-size:2.2em;">
Double Click, Paragraph to display alert
</p>

JQuery script for showing alert on double click of paragraph

<script language="javascript" type="text/javascript">
    $(document).ready(function () {


        $("#MyPara").dblclick(
            function () {
                ShowAlert();
            }
        );


    });


    function ShowAlert() {
        alert("Alert message on double click");
    }
</script>



Double click event is almost similar to click event, here instead of click we have used dblclick.

I will be discussing more JQuery examples in JQuery example series.

No comments:

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape