How to pass the selected value in the input in the other input?


Is there a website to order a taxi inTaxi Ljubljana

You can order directly through the form Book Now
Ie to see the form you need to do step 1 - click the button.
Want to simplify the order and on the first section showing 2 inputa to the input points A and B (let us denote A-1 and B-1). When you click on the button to open a form which is already filled in fields A-2 and B-2 and drawn the route.

This is some sort of copying content from the input, A-1 and B-1 input A-2 and B-2.
Did all this with a small script:

function copyValueTo(fromElem, toElemId) {
 var elem = document.getElementById(toElemId);
 elem.value = fromElem.value;

<input id="pickup-point-input-out" type="text" name="pickupPoint" required placeholder=" " onkeyup="copyValueTo(this, 'pickup-point-input')">

pickup-point-input-out = A-1
pickup-point-input = A-2

And copied everything seems fine but there is one thing:
These inputy screwed Search from Google
var places;
 var PickupInput = document.getElementById('pickup-point-input');
 var countryRestrict = {'country': ['si', 'au', 'hr', 'it', 'hu']};

 var autocompletePickup = new google.maps.places.Autocomplete(PickupInput, {
 componentRestrictions: countryRestrict

And if you enter in box A-1 3 character - search finds address, select it. But in the field And made only 2 of these 3 characters.
PS at the very bottom of the website added box A-1, in the form of field A-2. Values are copied from A-1 to A-2 and back

Question: what do you need to fix/add to make the script understand that we chose the address, and the value copied from the field A-1 field A-2
March 19th 20 at 09:19
1 answer
March 19th 20 at 09:21
It's simple. Copy the value not in the input box, and clicking the button "Book now".

Find more questions by tags HTMLjQueryJavaScript