Reputation: 51
I have two text fields on different pages. One text field with the id a
is on page 1
and second text field with the id b
is on page 2
.
I want to know how can I get data from 1st text field and put it into 2nd text field with jQuery.
Upvotes: 0
Views: 77
Reputation: 34895
You need to transfer the value from one page to the other when navigating. You can do this via url parameters and you can access them via the URL.
Here's an example: Page 1 HTML:
<a id="link" href="#">Link</a>
<input type="text" id="a" value="some value" />
Page 1 JS:
$('#link').click(function (event) {
$(this).attr('href', 'page2.html?text=' + $('#a').val());
});
Page 2: Refer to this post on how to extract the URL parameter.
Upvotes: 1