Basic JS - document.write to val(

Hi,

I have the following:


.....
document.write(hours + minutes + day + month + year)

jQuery(document).ready(function(){
jQuery('#purchase_order').val('xxxxxxxx');
....

I want to populate the xxxxxx with the result of the document.write

I.e. I am generating a variable which is time & date, and want that in the val(‘xxxx’) field

It’s probably very simple, but I’m short on js skills - thinking need to define the time/date as a variable and then populate that into val(‘’) somehow?

Many thanks in advance
Rob

Something like this?

var set = hours + minutes + day + month + year;
document.write(set);

jQuery(document).ready(function(){
    jQuery('#purchase_order').val(set);
});

Spot on, thank you heaps!!

No problem