How to add on click event in google map marker?












2















I am calling this view with a geolist containing longitude, and latitude values.



I convert it to an array.



var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));


then within loop I put those values to markers,



    for (var i = 0; i < geoArray.length; i++)
{
var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
var markers = new google.maps.Marker({
position: myLatLng,
map: map,
title: geoArray[i].SubmittedBy

});

}


Now, I want to create a click event here for markers so that when I click on the marker I can show some information about the place. Also, on clicking I want to zoom to that place.



My full script code is :



<script>


var map;
var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';




function initMap() {
// Map options
var options = {
zoom: 6,
center: { lat: 23.6850, lng: 90.3563 }
}
var ctaLayer = new google.maps.KmlLayer({
url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
map: map
});

// New map
var map = new google.maps.Map(document.getElementById('map'), options);


var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

for (var i = 0; i < geoArray.length; i++) {
var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
var markers = new google.maps.Marker({
position: myLatLng,
map: map,
title: geoArray[i].SubmittedBy

});
}


markers.addListener('click', toggleBounce);

// Loop through markers
for (var i = 0; i < markers.length; i++)
{
addMarker(markers[i]);
}

// Add Marker Function
function addMarker(props) {
var marker = new google.maps.Marker({
position: props.coords,
map: map,
//icon:props.iconImage

});


google.maps.event.addListener(marker, 'click', function () {
map.setZoom(9);
map.setCenter(marker.getPosition());
});
// Check for customicon
if (props.iconImage) {
// Set icon image
marker.setIcon(props.iconImage);
}

// Check content
if (props.content) {
var infoWindow = new google.maps.InfoWindow({
content: props.content
});


//Adding KML leayer
var kmlLayer = new google.maps.KmlLayer(src,
{
suppressInfoWindows: true,
preserveViewport: false,
map: map
});
kmlLayer.addListener('click',
function(event) {
var content = event.featureData.infoWindowHtml;
var testimonial = document.getElementById('capture');
testimonial.innerHTML = content;
});


marker.addListener('click',
function() {
infoWindow.open(map, marker);
});
}

}


}
function toggleBounce(){
content:hello
}
</script>









share|improve this question





























    2















    I am calling this view with a geolist containing longitude, and latitude values.



    I convert it to an array.



    var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));


    then within loop I put those values to markers,



        for (var i = 0; i < geoArray.length; i++)
    {
    var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
    var markers = new google.maps.Marker({
    position: myLatLng,
    map: map,
    title: geoArray[i].SubmittedBy

    });

    }


    Now, I want to create a click event here for markers so that when I click on the marker I can show some information about the place. Also, on clicking I want to zoom to that place.



    My full script code is :



    <script>


    var map;
    var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';




    function initMap() {
    // Map options
    var options = {
    zoom: 6,
    center: { lat: 23.6850, lng: 90.3563 }
    }
    var ctaLayer = new google.maps.KmlLayer({
    url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
    map: map
    });

    // New map
    var map = new google.maps.Map(document.getElementById('map'), options);


    var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

    for (var i = 0; i < geoArray.length; i++) {
    var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
    var markers = new google.maps.Marker({
    position: myLatLng,
    map: map,
    title: geoArray[i].SubmittedBy

    });
    }


    markers.addListener('click', toggleBounce);

    // Loop through markers
    for (var i = 0; i < markers.length; i++)
    {
    addMarker(markers[i]);
    }

    // Add Marker Function
    function addMarker(props) {
    var marker = new google.maps.Marker({
    position: props.coords,
    map: map,
    //icon:props.iconImage

    });


    google.maps.event.addListener(marker, 'click', function () {
    map.setZoom(9);
    map.setCenter(marker.getPosition());
    });
    // Check for customicon
    if (props.iconImage) {
    // Set icon image
    marker.setIcon(props.iconImage);
    }

    // Check content
    if (props.content) {
    var infoWindow = new google.maps.InfoWindow({
    content: props.content
    });


    //Adding KML leayer
    var kmlLayer = new google.maps.KmlLayer(src,
    {
    suppressInfoWindows: true,
    preserveViewport: false,
    map: map
    });
    kmlLayer.addListener('click',
    function(event) {
    var content = event.featureData.infoWindowHtml;
    var testimonial = document.getElementById('capture');
    testimonial.innerHTML = content;
    });


    marker.addListener('click',
    function() {
    infoWindow.open(map, marker);
    });
    }

    }


    }
    function toggleBounce(){
    content:hello
    }
    </script>









    share|improve this question



























      2












      2








      2


      2






      I am calling this view with a geolist containing longitude, and latitude values.



      I convert it to an array.



      var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));


      then within loop I put those values to markers,



          for (var i = 0; i < geoArray.length; i++)
      {
      var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
      var markers = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: geoArray[i].SubmittedBy

      });

      }


      Now, I want to create a click event here for markers so that when I click on the marker I can show some information about the place. Also, on clicking I want to zoom to that place.



      My full script code is :



      <script>


      var map;
      var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';




      function initMap() {
      // Map options
      var options = {
      zoom: 6,
      center: { lat: 23.6850, lng: 90.3563 }
      }
      var ctaLayer = new google.maps.KmlLayer({
      url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
      map: map
      });

      // New map
      var map = new google.maps.Map(document.getElementById('map'), options);


      var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

      for (var i = 0; i < geoArray.length; i++) {
      var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
      var markers = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: geoArray[i].SubmittedBy

      });
      }


      markers.addListener('click', toggleBounce);

      // Loop through markers
      for (var i = 0; i < markers.length; i++)
      {
      addMarker(markers[i]);
      }

      // Add Marker Function
      function addMarker(props) {
      var marker = new google.maps.Marker({
      position: props.coords,
      map: map,
      //icon:props.iconImage

      });


      google.maps.event.addListener(marker, 'click', function () {
      map.setZoom(9);
      map.setCenter(marker.getPosition());
      });
      // Check for customicon
      if (props.iconImage) {
      // Set icon image
      marker.setIcon(props.iconImage);
      }

      // Check content
      if (props.content) {
      var infoWindow = new google.maps.InfoWindow({
      content: props.content
      });


      //Adding KML leayer
      var kmlLayer = new google.maps.KmlLayer(src,
      {
      suppressInfoWindows: true,
      preserveViewport: false,
      map: map
      });
      kmlLayer.addListener('click',
      function(event) {
      var content = event.featureData.infoWindowHtml;
      var testimonial = document.getElementById('capture');
      testimonial.innerHTML = content;
      });


      marker.addListener('click',
      function() {
      infoWindow.open(map, marker);
      });
      }

      }


      }
      function toggleBounce(){
      content:hello
      }
      </script>









      share|improve this question
















      I am calling this view with a geolist containing longitude, and latitude values.



      I convert it to an array.



      var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));


      then within loop I put those values to markers,



          for (var i = 0; i < geoArray.length; i++)
      {
      var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
      var markers = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: geoArray[i].SubmittedBy

      });

      }


      Now, I want to create a click event here for markers so that when I click on the marker I can show some information about the place. Also, on clicking I want to zoom to that place.



      My full script code is :



      <script>


      var map;
      var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';




      function initMap() {
      // Map options
      var options = {
      zoom: 6,
      center: { lat: 23.6850, lng: 90.3563 }
      }
      var ctaLayer = new google.maps.KmlLayer({
      url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
      map: map
      });

      // New map
      var map = new google.maps.Map(document.getElementById('map'), options);


      var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

      for (var i = 0; i < geoArray.length; i++) {
      var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
      var markers = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: geoArray[i].SubmittedBy

      });
      }


      markers.addListener('click', toggleBounce);

      // Loop through markers
      for (var i = 0; i < markers.length; i++)
      {
      addMarker(markers[i]);
      }

      // Add Marker Function
      function addMarker(props) {
      var marker = new google.maps.Marker({
      position: props.coords,
      map: map,
      //icon:props.iconImage

      });


      google.maps.event.addListener(marker, 'click', function () {
      map.setZoom(9);
      map.setCenter(marker.getPosition());
      });
      // Check for customicon
      if (props.iconImage) {
      // Set icon image
      marker.setIcon(props.iconImage);
      }

      // Check content
      if (props.content) {
      var infoWindow = new google.maps.InfoWindow({
      content: props.content
      });


      //Adding KML leayer
      var kmlLayer = new google.maps.KmlLayer(src,
      {
      suppressInfoWindows: true,
      preserveViewport: false,
      map: map
      });
      kmlLayer.addListener('click',
      function(event) {
      var content = event.featureData.infoWindowHtml;
      var testimonial = document.getElementById('capture');
      testimonial.innerHTML = content;
      });


      marker.addListener('click',
      function() {
      infoWindow.open(map, marker);
      });
      }

      }


      }
      function toggleBounce(){
      content:hello
      }
      </script>






      javascript asp.net-mvc google-maps google-maps-api-3 google-maps-markers






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 20 at 7:32









      Umar Abdullah

      883418




      883418










      asked Jan 20 at 7:08









      Shoaib AhmedShoaib Ahmed

      144




      144
























          1 Answer
          1






          active

          oldest

          votes


















          0














          In you could use a closure using a function fo create the listener in this case the function addListenerOnMarker



          <script>


          var map;
          var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';

          function initMap() {
          // Map options
          var options = {
          zoom: 6,
          center: { lat: 23.6850, lng: 90.3563 }
          }
          var ctaLayer = new google.maps.KmlLayer({
          url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
          map: map
          });

          // New map
          var map = new google.maps.Map(document.getElementById('map'), options);


          var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

          var addListenerOnMarker = function(actMarker){

          actMarker.addListener('click', function() {
          map.setZoom(9);
          map.setCenter(actMarker.getPosition());
          });

          }

          for (var i = 0; i < geoArray.length; i++) {
          var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
          var markers = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: geoArray[i].SubmittedBy

          });
          addListenerOnMarker(markers);
          }

          </script>


          Be careful at the proper use of var and array .. in your code you don't produce an array of markers but just create (and recreate ) a single marker i have leave the name markers and the remove the not propedeutical rest of code ..
          (for produce an array of obeject (eg_marker) you should push the object inside and array . )






          share|improve this answer


























          • Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

            – Shoaib Ahmed
            Jan 20 at 9:36











          • the code work .. ???

            – scaisEdge
            Jan 20 at 13:01











          • Yes code work..

            – Shoaib Ahmed
            Jan 20 at 18:11











          • This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

            – scaisEdge
            Jan 20 at 18:14











          • can you give me the code portion of how can I show details on clicking a marker ?

            – Shoaib Ahmed
            Jan 20 at 19:03











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274331%2fhow-to-add-on-click-event-in-google-map-marker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          In you could use a closure using a function fo create the listener in this case the function addListenerOnMarker



          <script>


          var map;
          var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';

          function initMap() {
          // Map options
          var options = {
          zoom: 6,
          center: { lat: 23.6850, lng: 90.3563 }
          }
          var ctaLayer = new google.maps.KmlLayer({
          url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
          map: map
          });

          // New map
          var map = new google.maps.Map(document.getElementById('map'), options);


          var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

          var addListenerOnMarker = function(actMarker){

          actMarker.addListener('click', function() {
          map.setZoom(9);
          map.setCenter(actMarker.getPosition());
          });

          }

          for (var i = 0; i < geoArray.length; i++) {
          var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
          var markers = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: geoArray[i].SubmittedBy

          });
          addListenerOnMarker(markers);
          }

          </script>


          Be careful at the proper use of var and array .. in your code you don't produce an array of markers but just create (and recreate ) a single marker i have leave the name markers and the remove the not propedeutical rest of code ..
          (for produce an array of obeject (eg_marker) you should push the object inside and array . )






          share|improve this answer


























          • Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

            – Shoaib Ahmed
            Jan 20 at 9:36











          • the code work .. ???

            – scaisEdge
            Jan 20 at 13:01











          • Yes code work..

            – Shoaib Ahmed
            Jan 20 at 18:11











          • This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

            – scaisEdge
            Jan 20 at 18:14











          • can you give me the code portion of how can I show details on clicking a marker ?

            – Shoaib Ahmed
            Jan 20 at 19:03
















          0














          In you could use a closure using a function fo create the listener in this case the function addListenerOnMarker



          <script>


          var map;
          var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';

          function initMap() {
          // Map options
          var options = {
          zoom: 6,
          center: { lat: 23.6850, lng: 90.3563 }
          }
          var ctaLayer = new google.maps.KmlLayer({
          url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
          map: map
          });

          // New map
          var map = new google.maps.Map(document.getElementById('map'), options);


          var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

          var addListenerOnMarker = function(actMarker){

          actMarker.addListener('click', function() {
          map.setZoom(9);
          map.setCenter(actMarker.getPosition());
          });

          }

          for (var i = 0; i < geoArray.length; i++) {
          var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
          var markers = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: geoArray[i].SubmittedBy

          });
          addListenerOnMarker(markers);
          }

          </script>


          Be careful at the proper use of var and array .. in your code you don't produce an array of markers but just create (and recreate ) a single marker i have leave the name markers and the remove the not propedeutical rest of code ..
          (for produce an array of obeject (eg_marker) you should push the object inside and array . )






          share|improve this answer


























          • Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

            – Shoaib Ahmed
            Jan 20 at 9:36











          • the code work .. ???

            – scaisEdge
            Jan 20 at 13:01











          • Yes code work..

            – Shoaib Ahmed
            Jan 20 at 18:11











          • This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

            – scaisEdge
            Jan 20 at 18:14











          • can you give me the code portion of how can I show details on clicking a marker ?

            – Shoaib Ahmed
            Jan 20 at 19:03














          0












          0








          0







          In you could use a closure using a function fo create the listener in this case the function addListenerOnMarker



          <script>


          var map;
          var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';

          function initMap() {
          // Map options
          var options = {
          zoom: 6,
          center: { lat: 23.6850, lng: 90.3563 }
          }
          var ctaLayer = new google.maps.KmlLayer({
          url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
          map: map
          });

          // New map
          var map = new google.maps.Map(document.getElementById('map'), options);


          var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

          var addListenerOnMarker = function(actMarker){

          actMarker.addListener('click', function() {
          map.setZoom(9);
          map.setCenter(actMarker.getPosition());
          });

          }

          for (var i = 0; i < geoArray.length; i++) {
          var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
          var markers = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: geoArray[i].SubmittedBy

          });
          addListenerOnMarker(markers);
          }

          </script>


          Be careful at the proper use of var and array .. in your code you don't produce an array of markers but just create (and recreate ) a single marker i have leave the name markers and the remove the not propedeutical rest of code ..
          (for produce an array of obeject (eg_marker) you should push the object inside and array . )






          share|improve this answer















          In you could use a closure using a function fo create the listener in this case the function addListenerOnMarker



          <script>


          var map;
          var src = 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml';

          function initMap() {
          // Map options
          var options = {
          zoom: 6,
          center: { lat: 23.6850, lng: 90.3563 }
          }
          var ctaLayer = new google.maps.KmlLayer({
          url: 'https://s3-ap-southeast-1.amazonaws.com/cloudcreativeltd/Rail_Ex_RoW_my.kml',
          map: map
          });

          // New map
          var map = new google.maps.Map(document.getElementById('map'), options);


          var geoArray = @Html.Raw(Json.Encode(@ViewBag.GeoList));

          var addListenerOnMarker = function(actMarker){

          actMarker.addListener('click', function() {
          map.setZoom(9);
          map.setCenter(actMarker.getPosition());
          });

          }

          for (var i = 0; i < geoArray.length; i++) {
          var myLatLng = new google.maps.LatLng(geoArray[i].Latitude, geoArray[i].Longitude);
          var markers = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: geoArray[i].SubmittedBy

          });
          addListenerOnMarker(markers);
          }

          </script>


          Be careful at the proper use of var and array .. in your code you don't produce an array of markers but just create (and recreate ) a single marker i have leave the name markers and the remove the not propedeutical rest of code ..
          (for produce an array of obeject (eg_marker) you should push the object inside and array . )







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 20 at 13:02

























          answered Jan 20 at 8:04









          scaisEdgescaisEdge

          93.7k104970




          93.7k104970













          • Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

            – Shoaib Ahmed
            Jan 20 at 9:36











          • the code work .. ???

            – scaisEdge
            Jan 20 at 13:01











          • Yes code work..

            – Shoaib Ahmed
            Jan 20 at 18:11











          • This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

            – scaisEdge
            Jan 20 at 18:14











          • can you give me the code portion of how can I show details on clicking a marker ?

            – Shoaib Ahmed
            Jan 20 at 19:03



















          • Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

            – Shoaib Ahmed
            Jan 20 at 9:36











          • the code work .. ???

            – scaisEdge
            Jan 20 at 13:01











          • Yes code work..

            – Shoaib Ahmed
            Jan 20 at 18:11











          • This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

            – scaisEdge
            Jan 20 at 18:14











          • can you give me the code portion of how can I show details on clicking a marker ?

            – Shoaib Ahmed
            Jan 20 at 19:03

















          Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

          – Shoaib Ahmed
          Jan 20 at 9:36





          Is there any onclick marker function so that whenever I click on a marker It shows some information about the marker's place.

          – Shoaib Ahmed
          Jan 20 at 9:36













          the code work .. ???

          – scaisEdge
          Jan 20 at 13:01





          the code work .. ???

          – scaisEdge
          Jan 20 at 13:01













          Yes code work..

          – Shoaib Ahmed
          Jan 20 at 18:11





          Yes code work..

          – Shoaib Ahmed
          Jan 20 at 18:11













          This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

          – scaisEdge
          Jan 20 at 18:14





          This mean that my answer resolve your question .. for you comment you should extend the onListenerOnMarker functio passing the value you want ad add fo exampe to an info window )

          – scaisEdge
          Jan 20 at 18:14













          can you give me the code portion of how can I show details on clicking a marker ?

          – Shoaib Ahmed
          Jan 20 at 19:03





          can you give me the code portion of how can I show details on clicking a marker ?

          – Shoaib Ahmed
          Jan 20 at 19:03




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274331%2fhow-to-add-on-click-event-in-google-map-marker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Homophylophilia

          Updating UILabel text programmatically using a function

          Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage