I'm trying to record the date and time of when a user has submitted a form.
I'm required to capture the date and time in a hidden field.
I've created a function which displays the date and time but I'm unable to get this into the hidden input value.
This is the current way I've been trying.
function dateTime() {
new Date($.now());
}
$("#DateTime").attr("value", dateTime());
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="DateTime" name="DateTime" type="" value="">
Any suggestions or ideas on where I might be going wrong would be great.
Thanks in advance!