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 Datetime form Property
The HTML DOM Input Datetime form property returns the reference of enclosing form for input datetime.
Syntax
Following is the syntax −
Returning reference to the form object
inputDatetimeObject.form
Example
Let us see an example of Input Datetime form property −
<!DOCTYPE html>
<html>
<head>
<title>Input Datetime form</title>
</head>
<body>
<form id="dateTimeForm">
Date & Time: <input type="datetime" id="Datetime" value="2009-12-19T12:48Z">
</form>
<button onclick="getFormID()">Get Form ID</button>
<div id="divDisplay"></div>
<script>
function getFormID() {
var inputDatetime = document.getElementById("Datetime");
var divDisplay = document.getElementById("divDisplay");
divDisplay.textContent = 'Form ID for datetime input: '+inputDatetime.form.id;
}
</script>
</body>
</html>
Output
This will produce the following output −
Before clicking ‘Get Form ID’ button −

After checking ‘Get Form ID’ button −

Advertisements