Search code examples
google-maps-api-3tooltipnewlinemarker

google maps formatting text of a marker tooltip on multiple lines


How do I insert a newline into text of a marker tooltip. I am using \n which doesn't seem to be working.

See code below:

mark = new google.maps.Marker({          
        map: map,             
        position: center,
        title:inspStates[i].name+ "\n"+"total: "+inspStates[i].totalInsp+ "\n"+ info,
        zIndex:3
});

Solution

  • I used a customized google infoBox in place of the tooltip and it formatted properly see here: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html