Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 1.04 KB

File metadata and controls

53 lines (38 loc) · 1.04 KB

⚠️ This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

marker.setTitle()

Change the marker title

marker.setTitle(title);

Parameters

name type description
title string new title

Demo code

<div id="map_canvas"></div>
var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div);

// Add a marker
var marker = map.addMarker({
  'position': {
    lat: 0,
    lng: 0
  },
  'title': "Click me!"
});

// Show the infoWindow
marker.showInfoWindow();

// Catch the MARKER_CLICK event
marker.on(plugin.google.maps.event.INFO_CLICK, function() {

  // Change the marker title
  marker.setTitle("Clicked!");

  // Redraw (reopen) the infoWindow.
  marker.showInfoWindow();

});