How to enable button using JQuery?

In this article, you will learn how to enable button using JQuery. In the previous article i have shown how to disable button using JQuery. These are good JQuery Interview Questions. In this example we are using removeAttr() method for disable button. If you run below code one button will come. If you click on that button, button will disable and message will show. After that click on message, that button will enable.
Output:


<html>
<head>
    <title></title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#btnDisable").click(function () {
                    $(this).attr("disabled", "disabled");
                    $("#output").html("<b>Click me button will enable now <br />http://www.aspnettutorialonline.blogspot.com/ </b>");
                });
                $("#output").click(function () {
                    $("#btnDisable").removeAttr("disabled");
                    $("#output").html(" ");
                });
            });
        </script>
</head>
<body>
<input type="button" value="I will disable by click" id="btnDisable" />
<div id="output">
</div>
</body>
</html>

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