I want to update a forms textfield with the date and time when a user clicks the button. Cant seem to get it to work.
<form id="form1" action="http://google.com">
<input id="textField1" type="text" value="0" align="right" size="13"/><br>
<input id="button1" type="button" value="1" onclick="display()">
</form>
<script type="text/javascript">
function display()
{
document.getElementById("textField1").value = "<?php echo datetime() ?>";
}
</script>
You can use Date.toString for this
JSFiddle