We can create an <input> element with type="datetime-local" via the document.createElement()
method:
Click the button to create a Local Datetime field.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {//w ww .j a va2 s . co m var x = document.createElement("INPUT"); x.setAttribute("type", "datetime-local"); document.body.appendChild(x); } </script> </body> </html>