
- 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
HTML DOM Input Date readOnly Property
The HTML DOM Input Date readOnly property sets/returns whether Input Date can be modified or not.
Syntax
Following is the syntax −
- Returning boolean value - true/false
inputDateObject.readOnly
- Setting readOnly to booleanValue
inputDateObject.readOnly = booleanValue
Boolean Values
Here, “booleanValue” can be the following −
booleanValue | Details |
---|---|
true | It defines that the input date is readOnly. |
false | It defines that the input date is not readOnly and can be modified. |
Example
Let us see an example of Input Date readOnly property −
<!DOCTYPE html> <html> <head> <title>Input Date readOnly</title> </head> <body> <form> Final Exam Date: <input type="date" id="dateSelect"> </form> <button onclick="finalizeDate()">Confirm Date</button> <div id="divDisplay"></div> <script> var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); divDisplay.textContent = 'Exam Date Finalized: '+inputDate.readOnly; function finalizeDate() { inputDate.readOnly = true; divDisplay.textContent = 'Exam Date: '+inputDate.value; } </script> </body> </html>
Output
This will produce the following output −
Before clicking ‘Confirm Date’ button −
After clicking ‘Confirm Date’ button −
- Related Articles
- HTML DOM Input Month readOnly Property
- HTML DOM Input Number readOnly Property
- HTML DOM Input Password readOnly property
- HTML DOM Input Datetime readOnly Property
- HTML DOM Input DatetimeLocal readOnly Property
- HTML DOM Input Email readOnly Property
- HTML DOM Input Time readOnly Property
- HTML DOM Input URL readOnly Property
- HTML DOM Input Week readOnly Property
- HTML DOM Input Search readOnly property
- HTML DOM Input Text readOnly property
- HTML DOM Input Date autofocus Property
- HTML DOM Input Date disabled Property
- HTML DOM Input Date form Property
- HTML DOM Input Date name Property

Advertisements