Open In App

jQuery :disabled Selector

The jQuery :disabled selector is used for selecting all disabled form elements. 

Syntax: 



$(":disabled")

Parameter: 

Example 1: 






<!DOCTYPE html>
<html>
 
<head>
    <title>:disabled Selector</title>
    <script src=
    </script>
    <script>
        $(document).ready(function () {
            $(":disabled").css(
                "background-color", "green");
        });
    </script>
</head>
 
<body>
    <center>
        <form action="#">
            <h1>Welcome to GeeksforGeeks!.
            </h1>
            <div>
                Text :
                <input type="text" name="text"
                       disabled="disabled">
                <br />
                <br /> Select :
                <select>
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                    <option>4</option>
                </select>
            </div>
        </form>
    </center>
</body>
 
</html>

Output:

  

Example 2: 




<!DOCTYPE html>
<html>
 
<head>
    <title>:disabled Selector
    </title>
    <script src=
    </script>
    <script>
        $(document).ready(function () {
            $(":disabled").css(
                "background-color", "green");
        });
    </script>
</head>
 
<body>
    <center>
        <form action="#">
            <h1>Welcome to GeeksforGeeks!.
            </h1>
            <div>
                Text :
                <input type="text" name="text"
                       value="GeeksforGeeks">
                <br />
                <input type="submit" name="submit"
                       value="submit" disabled="disabled">
            </div>
        </form>
    </center>
</body>
 
</html>

Output: 


Article Tags :