I know next to nothing about Javascript. I think I am almost there but need some help...
I need to pass UTC into a hidden field in an HTML form. The actual time doesn't really matter, just using it as an order identifier that will be unique for each order.
Here is what I have but it isn't working... Appreciate any help.
--- in form section ---
<input id="pg_consumerorderid" value="" type="hidden">
--- Script just below the < /form> tag
<script>
var field = document.querySelector('#pg_consumerorderid');
var date = Date.now();
// Set the date
field.value = date;
</script>
All my other form fields use input name= instead of the input id= Not sure if that is messing things up.
Thanks!
Kalhan.Toress said in a comment which gave the answer:
you have to keep both name and id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.