Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8748515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:32:15+00:00 2026-06-13T12:32:15+00:00

how would I go about adding additional markers to this set up? There are

  • 0

how would I go about adding additional markers to this set up? There are currently three and I’ve been messing around with it, but I’m not sure how to continue adding markers to it

I’ve been trying things on this JS Bin as well http://jsbin.com/agemuw/2/edit but haven’t got it working

JS:

<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
var locations = [
[
"850 Boylston Street",
"Chestnut Hill, MA 02467",
"42.326435",
"-71.149499"
],
[
"Subway Brookline Village",
"Green Line, D",
"42.33279",
"-71.11630"
],
[
"Shuttle Brookline Village",
"10 Brookline Place",
"42.33262",
"-71.116439"
]
];

gmarkers = [];

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: new google.maps.LatLng(42.326435, -71.149499),
mapTypeId: google.maps.MapTypeId.ROADMAP
});

var infowindow = new google.maps.InfoWindow();


function createMarker(latlng, html) {
var marker = new google.maps.Marker({
    position: latlng,
    map: map
});

google.maps.event.addListener(marker, 'click', function() {
    infowindow.setContent(html);
    infowindow.open(map, marker);
});
return marker;
}

for (var i = 0; i < locations.length; i++) {
/*    alert("location:"+
      locations[i][0]+":"+locations[i][2]+","+locations[i][3]);
*/
gmarkers[locations[i][0]]=
createMarker(new google.maps.LatLng(locations[i][2], locations[i][3]), locations[i][0]    
+ "<br>" + locations[i][1]);
}

/*                                                    
$(function() {
$('#locations h3 a').each(function() { 
    $(this).on('click', function() { 
        google.maps.event.trigger(marker, 'click');    
    })    
  });    
});

*/
});//]]>  

html:

<body>      
    <div id="map" style="width: 500px; height: 400px;"></div>

    <div id="locations">
        <h3><a href="javascript:google.maps.event.trigger(gmarkers['850 Boylston  
Street'],'click');">850 Boylston Street</a></h3>
        <p>Arbitrary content about 1</p>

        <h3><a href="javascript:google.maps.event.trigger(gmarkers['Subway Brookline 
Village'],'click');">Brookline Village T Stop</a></h3>
        <p>Arbitrary content about 2</p>

        <h3><a href="javascript:google.maps.event.trigger(gmarkers['Shuttle Brookline 
Village'],'click');">Shuttle - 10 Brookline Place</a></h3>
        <p>Arbitrary content about 3</p>

    </div>

</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:32:16+00:00Added an answer on June 13, 2026 at 12:32 pm

    you have a Javascript error

    after the 3rd location you are missing a comma , after the square bracket ]

    ///....snip
    "10 Brookline Place",
    "42.33262",
    "-71.116439"
    ], //right here
    [
    "Subway Chestnut Hill",
    "Green Line, D",
    ///...snip
    

    EDIT

    adding custom markers to the map
    Add the icon property like below – easy way is to just put a url in – hard way if you want to define shadows and anchor points is to build one – see the Google Maps API for the in depth stuff

    var marker = new google.maps.Marker({
        icon : "http://urlofmymarker.png", //comma is important
        position: latlng,
        map: map
    });
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use Google Analytics but I am concerned about adding more
How would I go about adding a dynamic .......... to a restaurant menu in
How would someone go about adding check boxes to only the children of a
How would I go about dynamically adding commas as a user is entering numbers?
I would like to know how one goes about adding functionality from one open
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
Just a quick question about how you would go about implementing this. I want
Context: OS: Linux (Ubuntu), language: C (actually Lua, but this should not matter). I
Is there a way to tell Python about additional site-packages locations without modifying existing
I've been trying to find a solution for this but haven't seen anything useful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.