Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 DatetimeLocal form Property
The HTML DOM Input DatetimeLocal form property returns the reference of enclosing form for input DatetimeLocal.
Syntax
Following is the syntax −
Returning reference to the form object
inputDatetimeLocalObject.form
Example
Let us see an example of Input DatetimeLocal form property −
<!DOCTYPE html>
<html>
<head>
<title>Input DatetimeLocal form</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form id="Mathematics">
<fieldset>
<legend>Datetime-Local-form</legend>
<label for="datetimeLocalSelect">Examination Time:
<input type="datetime-local" id="datetimeLocalSelect" value="2019-09-01T09:00">
</label>
<input type="button" onclick="showExamination()" value="Which exam is on this date? ">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputDatetimeLocal = document.getElementById("datetimeLocalSelect");
function showExamination() {
divDisplay.textContent = 'Exam: '+inputDatetimeLocal.form.id;
}
</script>
</body>
</html>
Output
This will produce the following output −
Before clicking ‘Which exam is on this date?’ button −

After checking ‘Which exam is on this date?’ button −

Advertisements