Click here to Skip to main content
12,304,823 members (63,994 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.6K views
2 bookmarked
Posted

Disable button after click and display text [Processing...]

, 25 Apr 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Good, my solution is by using Client Javascript.aspx pagescript //by using jqueryfunction DocumentReady() { //Button disable...
Good, my solution is by using Client Javascript

.aspx page
<asp:Button ID="btnSave" runat="server" Text="Save" CssClass="btn DisableWhenClick"
                    CommandName="Save" OnClick="btnAction_Click" />

script //by using jquery
function DocumentReady() {
    //Button disable when Click
    $(".DisableWhenClick").click(function() {
        $(this).attr("disabled", true);
        $(this).val("Processing...");
    });

OK, then any button you need to disable when submit, you just need to add class "DisableWhenClick"

Enjoy!

License

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

Share

About the Author

duluohua
China China
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 2 Disables other functionality; that i... Pin
SteveSM27-May-11 12:25
memberSteveSM27-May-11 12:25 
GeneralThis alternative seems to disable the OnClick event. Pin
SteveSM25-May-11 16:32
memberSteveSM25-May-11 16:32 
GeneralGood one! Pin
Sunasara Imdadhusen2-May-11 22:54
memberSunasara Imdadhusen2-May-11 22:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 25 Apr 2011
Article Copyright 2011 by duluohua
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid