I have a button which I want to do a few different things at the same time and I'm lost on how to set the picker's value to the current datetime from my JavaScript. I've tried setting the picker directly and I'm able to see the datetime in the field, but it doesn't carry over to the hidden input. I then tried setting the hidden input directly but it also did not carry over to be visible in the field. Is there a better way to do this than to individually set both?
I have a button which I want to do a few different things at the same time and I'm lost on how to set the picker's value to the current datetime from my JavaScript. I've tried setting the picker directly and I'm able to see the datetime in the field, but it doesn't carry over to the hidden input. I then tried setting the hidden input directly but it also did not carry over to be visible in the field. Is there a better way to do this than to individually set both?
Setting Picker Field:
$('#completed-datetime')[0].value = dtFormat(new Date(), 'yyyy-mm-dd hh:mmi:ss');
Setting Hidden Input:
$("[name='datetime_completed']")[0].value = dtFormat(new Date(), 'yyyy-mm-dd hh:mmi:ss');
Thanks in advance for any assistance.