F
F
fantua2014-04-15 12:41:04
JavaScript
fantua, 2014-04-15 12:41:04

How to put a marker when loading a google maps map?

Hello.
I use this code: https://developers.google.com/maps/documentation/j...
Everything works well. You only need to enter the location in the location input field when loading the page and put a marker. AT

<input id="pac-input" class="controls" type="text" placeholder="Enter a location">

added the value parameter, the place is entered when loading, but the marker is not set. Tell me, please, how to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Obrezkov, 2014-04-15
@ghaiklor

Most likely you need to geocode the address into coordinates, and then only put a marker. The question is not very clear.

B
bzz, 2014-04-15
@bzz

I don't quite understand the question either, but I guess you mean this:

function initialize() {
...
      var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        title: "title",
        animation: google.maps.Animation.DROP
      });
...
infowindow.open(map, marker);
...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question