Open In App

Which input type is used to hide the input field to be displayed in HTML Form ?

Last Updated : 14 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The form tag is generally used to create forms for entering data. We can use different form tag attributes like text boxes, text area, checkboxes, radio buttons, buttons, dropdown list, etc. to collect data from the users.

We need to use the HTML <input type=”hidden”> type for hiding the input field. Using this attribute, the input field will no longer be visible on the page. The below example demonstrates the usage of the hidden attribute.

Example: In this example, we will use a normal input with the type of ‘text’ and another input with the type of ‘hidden’. This will help to demonstrate how the input field is hidden.

HTML




<!DOCTYPE html>
<html>
<body>
    <form>
        <h1 style="color: green;">Geeksforgeeks</h1>
        <strong>Login to Continue your Research</strong>
        <br>
        <label>Username</label>
        
        <!-- This input will be visible as it
              has the type set as 'text' -->
        <input type="text" 
               placeholder="enter your name">
        <br>
        
        <!-- This input will be hidden as it
              has the type set as 'hidden' -->
        <label>Password</label>
        <input type="hidden" 
               placeholder="Enter your password">
        <br>
        <button>Submit</button>
    </form>
</body>
</html>


Output:

HTML <input type=”hidden”>

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads