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

  • SEARCH
  • Home
  • 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 3242718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:20:53+00:00 2026-05-17T18:20:53+00:00

Hello I cannot figure out why I get this error. I’ve got a list

  • 0

Hello I cannot figure out why I get this error.

I’ve got a list with inputs which values contain lat/long/name/address.

Printing the markers on the map works fine, using the infowin workED fine, till I realized that it only openend the same info in all windows. Soo, obviously I needed to attach this (the marker i just clicked) to the eventListner.

But, when doing this I get an error saying view.createMarkerHTML is not a function.

Question: What do I do to attach the right info to be open, on the right marker?

view = {
        map: {
            init: function init (){
                view.map.initMap();
            },

            initMap: function initMap() {
                if(navigator.geolocation) {
                    function hasPosition(position) {
                        var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude),     
                        myOptions = {
                            zoom: 12,
                            center: point,
                            mapTypeId: google.maps.MapTypeId.ROADMAP
                        },   
                        mapDiv = document.getElementById("map"),
                        map = new google.maps.Map(mapDiv, myOptions);                        
                        view.map.handleMarkers(map);

                    }                    
                    navigator.geolocation.getCurrentPosition(hasPosition);

                } 
            },


            handleMarkers: function handleMarkers(map) {
                var list = $('#pois input'),
                    l = list.length,
                    i = 0, lat = '', long = '', marker = {}, theName = '', address = '', info = {};



                 for (i = 0; i < l; i += 1) {
                    info = $(list[i]).val().split('|');
                    lat = parseFloat(info[0], 10);
                    long = parseFloat(info[1], 10);
                    theName = info[2];
                    address = info[3];

                    marker = new google.maps.Marker({
                        position: new google.maps.LatLng(lat, long),
                        map: map,
                        icon: icon
                    }); 



                    google.maps.event.addListener(marker, 'click', function() {
                        currentMarker = this;view.map.createMarkerHTML(map, theName, address);
                    });                  
                 } 
            } ,

             createMarkerHTML: function createMarkerHTML(map, theName, address) {

                var contentString =
                    '<div id="gMapInfoWin">' +
                        '<h1>' + theName + '</h1>' +
                        '<ul>' +
                            '<li>' + address + '</li>' +
                        '</ul>' +
                    '</div>'
                ;

                currentMarker.infowindow = new google.maps.InfoWindow({
                    content: contentString
                });

                currentMarker.infowindow.open(map, currentMarker);
            } 
       }
};
  • 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-05-17T18:20:54+00:00Added an answer on May 17, 2026 at 6:20 pm
    for (i = 0; i < l; i += 1) {
                        info = $(list[i]).val().split('|');
                        lat = parseFloat(info[0], 10);
                        long = parseFloat(info[1], 10);
    
                        marker = new google.maps.Marker({
                            position: new google.maps.LatLng(lat, long),
                            map: map,
                            icon: icon
                        }); 
    
                       marker.theName = info[2];
                       marker.address = info[3];
    
                        google.maps.event.addListener(marker, 'click', function() {
                            currentMarker = this;   
                            m_name = this.theName;    
                            m_address = this.address        
                            view.map.createMarkerHTML(map, m_name, m_address);
                        });                  
                     } 
    

    marker.theName = info[2];
    marker.address = info[3];
    currentMarker = this;
    m_name = this.theName;
    m_address = this.address

    … is the soulution!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have a very weird problem in chrome I just cannot figure out!
Hello I have a bug in my app and I cannot figure it out.
I'm embarrassed to ask this, but I cannot figure out how to run a
This may come across as incredibly stupid, but I cannot figure out if: I
I get the error (see picture) I can't figure out what going on. It
I cannot figure out this javascript little oddity that's occurs in Firefox 7.0.1 and
I'm trying to figure out why this code doesn't work in C# and how
This one should be simple, but I can't figure it out myself. I have
This question may sound a bit stupid, but I couldn't figure out, how to
Ok this seems like a dumb question and probably is but I cannot figure

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.