
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to specify that the element must be filled out before submitting the form in HTML?
The required attribute in HTML is used to specify that the element should be filled before the form is submitted. If the field is not filled and the submit button is clicked, an error generates, which fails form submission. The error will be “Please fill out this field”.
The required attribute can be used on input, select and textarea element.
Example
You can try to run the following code to implement readonly attribute −
<!DOCTYPE html> <html> <head> <title>HTML placeholder attribute</title> </head> <body> <h2>Register</h2> <form action = "/new.php"> <input type = "text" placeholder = "Student UserName" name = "name" required/><br> <input type = "submit" value = "Submit"> </form> </body> </html>
- Related Articles
- How to specify whether the form-data should be encoded while submitting to the server with HTML?
- Resize image before submitting the form HTML5
- How to specify that the form should not be validated when disabled in HTML?
- How to specify that the form should not be validated when submitted in HTML?
- How to specify that the element is read-only in HTML?
- How to specify that an element should be pre-selected when the page loads in HTML?
- How to specify that the details should be visible to the user in HTML?
- How to specify that an element is not yet relevant in HTML?
- How to specify which form element a calculation is bound to with HTML?
- How to specify that the element should automatically get focus when the page loads in HTML?
- How to specify that an input element should be disabled?
- How to specify whether the content of an element should be translated or not in HTML?
- How to specify that the styles only apply to this element's parent element and that element's child elements in HTML?
- How to specify the language of the element's content in HTML?
- How to specify where to send the form-data when a form is submitted in HTML?

Advertisements