HTML DOM Input Date required Property
HTML DOM Input Date required Property
-- Learning not just technology, but dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference Manual
JavaScript Objects
- JavaScript Array Object
- JavaScript Boolean Object
- JavaScript Date Object
- JavaScript Math Object
- JavaScript Number Object
- JavaScript String Object
- JavaScript RegExp Object
- JavaScript Global Properties/Functions
- JavaScript Operators
- JavaScript Error
Browser Objects
DOM Objects
- HTML DOM Document Object
- HTML DOM Element Object
- HTML DOM Attribute Object
- HTML DOM Event Object
- HTML DOM Console Object
- CSSStyleDeclaration Object
- DOM HTMLCollection
HTML Objects
- <a>
- <area>
- <audio>
- <base>
- <blockquote>
- <body>
- <button>
- <canvas>
- <col>
- <colgroup>
- <datalist>
- <del>
- <details>
- <dialog>
- <embed>
- <fieldset>
- <form>
- <iframe>
- <frameset>
- <img>
- <ins>
- <input> - button
- <input> - checkbox
- <input> - color
- <input> - date
- <input> - datetime
- <input> - datetime-local
- <input> - email
- <input> - file
- <input> - hidden
- <input> - image
- <input> - month
- <input> - number
- <input> - range
- <input> - password
- <input> - radio
- <input> - reset
- <input> - search
- <input> - submit
- <input> - text
- <input> - time
- <input> - url
- <input> - week
- <keygen>
- <link>
- <label>
- <legend>
- <li>
- <map>
- <menu>
- <menuItem>
- <meta>
- <meter>
- <object>
- <ol>
- <optgroup>
- <option>
- <param>
- <progress>
- <q>
- <script>
- <select>
- <source>
- <style>
- <table>
- <td>
- <th>
- <tr>
- <textarea>
- <title>
- <time>
- <track>
- <video>
Deep Dive
- Scripts
- Scripting Languages
- Computer Science
- Software
- Web Design & Development
- Web Services
- Web Service
- Programming
- Development Tools
- Programming Languages
Input Date required Property
Example
Check if the date field is required before form submission:
var x = document.getElementById("myDate").required;
x output result:
true
Definition and Usage
The required property is used to set or return whether the date field must be filled out before submitting the form.
This property reflects the HTML required attribute.
Browser Support
The required property is supported in all major browsers, except Safari and Internet Explorer 9 and earlier versions.
Note: Internet Explorer or Firefox does not support the <input type="date"> element.
Syntax
Return the required property:
dateObject.required
Set the required property:
dateObject.required=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Specifies whether the date field is a required field in a form. * true - The date field is a required field in the form * false - Default. The date field is not a required field in the form |
Technical Details
| Return Value: | A Boolean. Returns true if the date field is a required field in a form, otherwise returns false. |
|---|
More Examples
Example
Set the date field as a required part of the form:
document.getElementById("myDate").required = true;
Related Pages
HTML Reference Manual: HTML <input> required Attribute
ByteDance Coding Plan supports Doubao, GLM, DeepSeek, Kimi, MiniMax, and other major...
YouTip