- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 −
Advertisements