Membuat select box dynamic gmaps

by septiane28

HTML

<!DOCTYPE html>
<html>
<head>
<title>test</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
 -->
 
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&libraries=places&callback=initialize"
async defer></script>

<script>
	  var geocoder;
	  var geoMarker;
		var map = null;
		var marker = [];
		var autocomplete = [];
		var gmarkers = [];
		var coba = "Caturra Espresso, Jalan Anjasmoro, Sawahan, Kota Surabaya, Jawa Timur";
		var autocompleteOptions = {
				componentRestrictions: {country: "id"}
		};

		$(document).ready(function(){
				var count = 0;
				$("#addInputField").click(function(){
						count++;
						
						var div = document.createElement('div');
						div.className = 'row';

						div.innerHTML = "<select id='pac-input' class='controlsInput'>  <option>-</option> <option value='Caturra Espresso, Jalan Anjasmoro, Sawahan, Kota Surabaya, Jawa Timur'>Caturra Espresso</option> <option>Red Planet Surabaya</option> <option>Pisang Keju Arjuna</option> </select> <button onclick='removeRow(this)'>X</button>";
						document.getElementById('inputlar').appendChild(div);
						var newInput = [];
						var newEl = document.getElementById('pac-input_' + count);
						newInput.push(newEl);
						setupAutocomplete(autocomplete, newInput, 0);

						if (count === 7) {
								$("#addInputField").remove();
						}
				});
		});

			$(function(){
				$(document).on('change', '.controlsInput', function(){
						alert('here');
						alert(this.value);
						alert("YENNY CUTE");
						geoMarker = new google.maps.Marker();
						geoMarker.setPosition(map.getCenter());
						geoMarker.setMap(map);
						var addr = this.value;

						var geocoder = new google.maps.Geocoder();
						geocoder.geocode({
							'address': addr
						}, function(results, status) {
							if (status ==...

CSS

/* Always set the map height explicitly to define the size of the div
 * element that contains the map. */
#map {
  height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
#description {
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
}

#infowindow-content .title {
  font-weight: bold;
}

#infowindow-content {
  display: none;
}

#map #infowindow-content {
  display: inline;
}

.pac-card {
  margin: 10px 10px 0 0;
  border-radius: 2px 0 0 2px;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  background-color: #fff;
  font-family: Roboto;
}

#pac-container {
  padding-bottom: 12px;
  margin-right: 12px;
}

.pac-controls {
  display: inline-block;
  padding: 5px 11px;
}

.pac-controls label {
  font-family: Roboto;
  font-size: 13px;
  font-weight: 300;
}

#pac-input {
  background-color: #fff;
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
  /* margin-left: 12px;
  padding: 0 11px 0 13px; */
  text-overflow: ellipsis;
  width: 400px;
}

.controlsInput{
	background-color: #fff;
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
  /* margin-left: 12px;
  padding: 0 11px 0 13px; */
  text-overflow: ellipsis;
  width: 400px;
	
}

#pac-input:focus {
  border-color: #4d90fe;
}

#title {
  color: #fff;
  background-color: #4d90fe;
  font-size: 25px;
  font-weight: 500;
  padding: 6px 12px;
}