Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic js - document.write to val(

Status
Not open for further replies.

amanxman

Technical User
Oct 8, 2005
19
0
0
NZ
Hi,

I have the following:

Code:
.....
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
 
document.write outputs to screen, if you want to place it into something else use variable, or write it directly in there.

Code:
var timeDate=hours + minutes + day + month + year;
jQuery('#purchase_order').val(timeDate);

or more simply:

jQuery('#purchase_order').val(hours + minutes + day + month + year);

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
var timeDate=hours + minutes + day + month + year;
jQuery('#purchase_order').val(timeDate);

Perfect, thank you. Knew it'd be simple!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top