Skip to content Skip to sidebar Skip to footer

Javascript - Pass A Value From Dropdown Box To Google Maps Api

I am creating a quote form for a taxi firm using Google Maps API. Currently, the user enters a start point and a pick up point into 2 text boxes and the API calculates the distance

Solution 1:

One solution would be to check the value of Address1 and Address2 before you manipulate any data in JS. Pseudocode below:

if (address1.value == '') { 
    address1.value = startapt.options[startapt.selectedIndex].text 
}
if (address2.value == '') { 
    address2.value = endapt.options[endapt.selectedIndex].text 
}

Then continue with the code you've already written.

Post a Comment for "Javascript - Pass A Value From Dropdown Box To Google Maps Api"