Disable buttons on post back using jquery in .net app

后端 未结 7 2016
悲哀的现实
悲哀的现实 2020-12-20 17:03

I have a asp.net app that I want to disable the buttons as soon as they are clicked in order to prevent multiple submissions. I\'d like to use jquery for this as the site a

7条回答
  •  囚心锁ツ
    2020-12-20 17:41

    I just wanted to add an additional resolution. We decided to just completely remove the button once it was clicked and replace it with some text.

    To do this we did:

    $(function () {
        $(".DisableButton").click(function () {
            $(this).hide();
            $(this).after('

    Please Wait. Retrieving information. This may take up to 60 seconds.

    '); }); });

    Note that this hides the button then injects some html after the buttons code. Hiding it allows .Net to go ahead and run the onclick handler during post back while removing it as a clickable thing on the screen.

提交回复
热议问题