How can I modify the markers?

you can create 1 array of type (restaurants,hotels)
or set default value of validate
and try this code:

var url = "";
if(a == "hotels"){
   url = "http://exampl.com/yellow.png";   
}else{
   url = "http://exampl.com/green.png"
}
marker_new[i] = google.maps.Marker({
                                 icon: _url;
                                 position: place.geometry.location,
                                 map: map
                               });

add to here

function showSelectedPlace() {
    clearResults();
    clearMarkers();
    var place = autocomplete.getPlace();
    map.panTo(place.geometry.location);
    markers[0] = new google.maps.Marker({
      position: place.geometry.location,
      map: map
    });
    iw = new google.maps.InfoWindow({
      content: getIWContent(place)
    });
    iw.open(map, markers[0]);
  }

and here

 places.search(search, function(results, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
       clearResults();
       clearMarkers();
        for (var i = 0; i < results.length; i++) {
          markers[i] = new google.maps.Marker({
            position: results[i].geometry.location,
            animation: google.maps.Animation.DROP
          });
          google.maps.event.addListener(markers[i], 'click', getDetails(results[i], i));
          setTimeout(dropMarker(i), i * 100);
          addResult(results[i], i);
        }
      }

Leave a Comment