VOOZH about

URL: https://www.geeksforgeeks.org/html/html-input-required-attribute/

⇱ HTML <input> required Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <input> required Attribute

Last Updated : 25 May, 2026

The required attribute is used to make an input field mandatory before submitting a form. It helps ensure that users fill in important fields.

  • Prevents form submission if the input field is left empty.
  • Commonly used with text fields, email inputs, checkboxes, and other form elements.
  • It is a boolean attribute, so its presence alone makes the field required.

Syntax: 

<input required> 

Example 1: Illustrates the use of required attribute in input Element. 

Example 2: Illustrates the use of required attribute in input Element. 

Comment
Article Tags: