ASP.NET Button – prevent double clicks part 2

by Mark Wiseman on June 2nd, 2010 | Posted in Revium Sandbox | Comment on this entry

It is amazing how may people out there still apply the double click paradigm to web applications.

What is frustrating is that some of the most simple methods for preventing the double click stop ASP.Net from firing the appropriate click event when the page is posted back.

A while ago Evgeny posted an article on how to prevent double clicks on buttons in ASP.Net. This solution was a little code heavy for my liking and so after a bit of playing around i came up with this simple jQuery solution.

That is where this little jQuery script come in. When the user clicks an input with the class of ‘button’ we will apply an attribute to it so that the next time the user clicks it, the event wont fire again. Easy!

$(document).ready(function () {
    //prevent double clicks
    $(".button").click(function () {
        if ($(this).attr("dblclick") != "true")
            $(this).attr("dblclick", "true");
        else
            return false;
    });
});


Related posts:

  1. ASP.NET Button – prevent double clicks
  2. jQuery image captions
  3. “Capitalise” jquery extension
  4. ASP.NET selectors in jquery
  5. Unique Arrays in PHP

Tags: asp.net, jquery

« The easy way to clear floated elements

Linq – SubmitChanges does not work »

Leave a Reply

Click here to cancel reply.

Recent Articles

  • Return of the daily sites
  • Collaborating with Government
  • Ya-bing-ooo!! Yahoo search is dead long live the Bing.
  • Social Media – Good For Some
  • 10 Tips for user acceptance testing of web applications
  • Popular Content Management Systems
  • ASP.NET MVC [HandleError] and logging
  • VMWare hard lessons

Twitter

  • Collaborating with Government: Revium is actively involved in the Federal Government’s R&D program for tax concess... http://bit.ly/9D7Vc6 6 days ago
  • 45 Free Applications For Web Designers & Developers http://www.noupe.com/tools/45-free-applications-for-designers-and-developers.html 1 week ago
  • In most watch advertisements the time displayed on the timepiece is 10:10 because then the arms frame the brand of the watch. 1 week ago
  • More updates...

Revium Logo

  • Home
  • About
  • Expertise
  • Showcase
  • Contact

  • news
  • blog
  • sandbox
  • twitter
  • facebook
  • rss
Bookmark and Share

We are Revium, hear us roar!

The news.

31 Aug

Collaborating with Government

Revium is actively involved in the Federal Government’s R&D program for tax concessions to develop our in-house products that we are looking to take…

Continue reading
View archive

The blog.

01 Sep

Return of the daily sites

Years ago I used to have a morning routine of checking a select few websites I came across. For one reason or another I…

Continue reading
View archive

The sandbox.

20 Aug

Ya-bing-ooo!! Yahoo search is dead long live the Bing.

Ya-bing-oo!! Yahoo search is dead long live the Bing In July 2010 Yahoo had started testing Bing powered search they routed 25% of their search…

Continue reading
View archive

eNewsletter.

 

© Copyright 2010. All Rights Reserved.

Revium Pty Ltd

e / info@revium.com.au t / Work +61 3 9429 2000

Find us: web development, seo

Disclaimer and privacy Revium Pty Ltd

10 Harvey Street
Richmond, Victoria, 3121 Australia
View map

Logo Partner MicrosoftLogo Partner KenticoLogo Partner IiaLogo Partner Iia RibLogo Partner Acs