I have a form, with several input fields that are title
, name
, address
etc
What I want to do, is to get these values and 'put them' into values of other input fields. For example
<label for="first_name">First Name</label>
<input type="text" name="name" />
<label for="surname">Surname</label>
<input type="text" name="surname" />
<label for="firstname">Firstname</label>
<input type="text" name="firstname" disabled="disabled" />
So If I enter John
in the first_name
field, then the value of firstname
will also be John
.
Many thanks
Assuming you can put ID's on the inputs:
JSFiddle Example
Otherwise you'll have to select using the names:
Add ID attributes with same values as name attributes and then you can do this:
Get input1 data to send them to input2 immediately
It's simpler if you modify your HTML a little bit:
then it's relatively simple