Open In App
Related Articles

How to specify that a group of related form elements should be disabled using HTML?

Improve Article
Improve
Save Article
Save
Like Article
Like

In this article, we will learn how to specify that a group of related form elements should be disabled using HTML. When the disabled attribute is present, it specifies that the input field is disabled. We can not write any content in a disabled input field.

Approach: We will be using the disabled attribute with the <fieldset> element. The disabled attribute for <fieldset> element in HTML is used to specify that the group of related form elements is disabled. A disabled fieldset is unclickable and unusable. It is a boolean attribute.

Syntax:

<fieldset disabled>content</fieldset>

Example: In this example, we will see the use of a disabled attribute.

HTML




<html>
 
<body style="text-align:center">
    <h2>
        How to specify that a group of related
        form elements should be disabled using HTML ?
    </h2>
    <p>This field set is disabled.</p>
   
    <!-- A disabled fieldset -->
    <fieldset disabled>
        Name: <input type="text"><br>
        Password: <input type="text"><br>
        <input type="submit" value="Click me">
 
    </fieldset>
    <p>This field set is not disabled.</p>
   
    <!-- Not a disabled fieldset -->
    <fieldset>
        Name: <input type="text"><br>
        Password: <input type="text"><br>
        <input type="submit" value="Click me">
    </fieldset>
</body>
 
</html>


Output:


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 16 Jun, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials