The Input type datetime property type specifies the type of input field, it always returns text. It allows to set and retrieve the type property of the input datetime field. It returns a string that represents the type of the input field.
1 <input>.type
2 <input>.type = <string>
input : A input type datetime element object to set and retrieve type property
string : It specifies the type of input field, it always text and it must be valid HTML input type
Input datetime property type
1 <!DOCTYPE html>
2 <html>
3 <style>
4 .container {
5 margin: 20px 0;
6 }
7 </style>
8 <body>
9 <h1>The Input Datetime Object</h1>
10 <h2>Example</h2>
11
12 <div class="container">
13 <input id="datetime" type="datetime" />
14 </div>
15
16 <button onclick="access()">Access</button>
17 <p id="result"></p>
18 <script>
19 function access() {
20 const element = document.getElementById("datetime");
21 const str = `The type of input element is : <b>${element.type}</b>`;
22 document.getElementById("result").innerHTML = str;
23 }
24 </script>
25 </body>
26 </html>
Input datetime property type
Related options for your search