Reputation: 9457
I tried the obvious and does not work...
var dtel = document.getElementById("element-id");
dtel.value = new Date();
It needs a string but what is the syntax?
Upvotes: 1
Views: 551
Reputation: 9457
After many trials and errors I found that the following works:
var dtel = document.getElementById("element-id");
var dt = new Date();
dtel.value = dt.toISOString();
Upvotes: 3