disabled selector in jQuery with example



disabled selector returns all disabled input elements.



Example :




    <html>
    <head>
    <title>disabled Selector</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
    <script type="text/javascript">
    $(document).ready(function()
    {
    $("#myButton").click(function()
    {
    $(":disabled").css("background-color","Orange");
    });
    });
    </script>
    </head>
    <body>
    <button type="button"  disabled="disabled">disabled</button>
    <input type="textbox" disabled="disabled"><br>
    <button type="button">enabled</button>
    <input type="textbox">
    <button id="myButton">Click</button>
    <button onclick="location.reload()">Reset</button>
    </body>
    </html>
    </html>
    

Demo :






In the above example, we have used disabled selector. Disabled selector returns all disabled input elements. In above example, it selects the disabled button and textbox and applies CSS to it.

0 comments:

Post a Comment