I've got a small bit of Javascript code in the head of the website:
<!-- Unique form ID -->
<script>
document.querySelector('input[name="form_submission_id"]').value = new Date();
</script>
My goal is to get a hidden form field with the name 'form submission id' to populate with a date stamp, but I keep getting the error - Cannot set property 'value' of null
If I go into inspector tools and unhide the hidden form field the above code works, if it's hidden I get the error.