Reputation: 5614
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?
Upvotes: 0
Views: 6565
Reputation: 11588
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.
Upvotes: 1