enabled selector in jQuery wih example



enabled selector returns all enabled input elements on the page.


Example :



    <html>
    <head>
    <title>enabled 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()
    {
    $(":enabled").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="locatio.reload()">Reset</button>
    </body>
    </html>
    

Demo :




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

0 comments:

Post a Comment