0

Basically I want to get the value of a textbox which is to select a date and output the value that is selected to another textbox.

These textboxes are on the same page (different steps of the same page) and the document is loaded when the page is ready on click of the next step, I've tried using:

$('#TextBox1').val($('#TextBox2').val());

But this doesn't seem to be working. What is it I am doing wrong?

EDIT

Here is some of the HTML:

I want to get the value the user has inputted for the Date for example:

<label for="txt-outbound-date" class="left p-input-label" >Date: </label>

<input type="text" id="txt-outbound-date" name="txt-outbound-date" class="input-txt-sml left required" />

And output the value they select in the following textbox:

<input type="text" class="input-txt-med required left" id="txt-selected-date" name="txt-selected-date" />

This is for a summary page which will display all the results the user has input, as I've said, this is all on one page and the .js file is loaded each time the user clicks 'Next' so I would have thought the following would work:

$('#txt-outbound-date').val($('#txt-selected-date').val());

Any suggestions?

1
  • Can we see the relevant html? Commented Mar 30, 2012 at 22:51

1 Answer 1

1

So you want to copy over the value of the selected textarea? You're referring to when a user clicks on the element?

$('textarea.clickable').click(function() {
   $('textarea.other').val($(this).val());
});

If not, could you be a bit more clear and precise about what you need.

Sign up to request clarification or add additional context in comments.

1 Comment

Basically I'm working on an online booking system, when a user enters values into the textboxes on the first two pages, I want to display the values they have entered into the textboxes or labels on the summary page which is all on one page. When the user clicks on 'Next Step' the .js file I have made is loaded again so that's why I thought I could use the code above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.