toolman Posted June 26, 2015 Share Posted June 26, 2015 Hi, I have the following code which I would like to insert into a field/hidden field. var now = new Date(); now.setDate(now.getDate()); document.getElementById("s_creation_date").innerHTML = now; I have the following HTML: <input type="text" name="s_creation_date" id="s_creation_date" /> I tried using the getElementbyId, but it didn't work. Any ideas? Thanks! Link to comment https://forums.phpfreaks.com/topic/297046-how-can-i-insert-this-into-a-field-hidden-field/ Share on other sites More sharing options...
fastsol Posted June 26, 2015 Share Posted June 26, 2015 Try document.getElementById("s_creation_date").value = now; Link to comment https://forums.phpfreaks.com/topic/297046-how-can-i-insert-this-into-a-field-hidden-field/#findComment-1515005 Share on other sites More sharing options...
toolman Posted June 26, 2015 Author Share Posted June 26, 2015 Many thanks, it worked! Link to comment https://forums.phpfreaks.com/topic/297046-how-can-i-insert-this-into-a-field-hidden-field/#findComment-1515008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.