Click here to Skip to main content
13,895,535 members
Rate this:
Please Sign up or sign in to vote.
Hello there. I have one button and if I click this button 2 times I want to alert message. how do I do jquery?

What I have tried:

I tried onclick and dblclick but i cant.
Updated 14-Oct-18 2:59am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can Try

var previousTarget=null;
$("a").click(function() {
    if(this===previousTarget) {
        alert("You've clicked this element twice.");
    return false;
yasin83 14-Oct-18 13:06pm
but the button is doing response.redirect. so 'return false' does not work when you do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190306.1 | Last Updated 14 Oct 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100