How to disable button using JQuery with Example

In most of the situations, we need to disable button for doing only one submission(Ex: Bank Transactions) for our applications. In the example, i am showing how to disable button using JQuery. For this disable operation, we have to use the attr() method. we are adding disabled= disabled to the button, while clicking on the button. After this we need to Enable button using JQuery.  This is one of the good JQuery Interview Question.

Output will be: 

        <script type="text/javascript" src=""></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#btnDisable").click(function () {
                    $(this).attr("disabled", "disabled");
                    $("#output").html("<b>Button is disabled by click on button <br /> </b>");
<input type="button" value="I will disable by click" id="btnDisable" />
<div id="output">

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar