Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
});
like image 832
trs Avatar asked Jul 26 '11 13:07

trs


1 Answers

Use single quotes (' ') instead of double quotes (" ")it will work, like this code.

mark = new google.maps.Marker({          
            map: map,             
            position: center,
            title:inspStates[i].name+ '\n total: '+inspStates[i].totalInsp+ '\n'+ info,
            zIndex:3
    });
like image 82
Sonu Kumar Avatar answered Oct 14 '22 02:10

Sonu Kumar