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 3229466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:48:50+00:00 2026-05-17T16:48:50+00:00

I was using the technique described here Click event in Google Map InfoWindow not

  • 0

I was using the technique described here Click event in Google Map InfoWindow not caught to dynamically add click event handlers to some of the content added to the Google Map InfoWindow. Works great except in IE.

I have content with normal anchor tags and those links work just fine.

I have an anchor tag with a jQuery (live) click handler read the id to trigger some other action and it does nothing in IE. Chrome/FF etc work just fine. I’ve tried using a div and span with no change to the behavior.

Any ideas?

Edit: This is with Google Maps v2 (I do know it is deprecated) and doesn’t work in IE 7 or 8. Haven’t bothered with IE6 on this project.

Edit: Here is a some sample code that repos the behavior.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

<style type="text/css">
#gmap{ height:450px;width:350px; }
</style>

<script type="text/javascript">
    var gmap;
    var sampleLatLon = new GLatLng(37.4419, -122.1419);
    var sampleIcon = new GIcon(G_DEFAULT_ICON);

    $(document).ready(function () {

        // Google maps setup
        $(window).unload(function () { GUnload(); });
        var gmap = new GMap2(document.getElementById("gmap"));
        gmap.setCenter(sampleLatLon, 13);
        gmap.setUIToDefault();

        // Marker and InfoWindow setup
        var marker = new GMarker(sampleLatLon, { icon: sampleIcon });
        var infoWindowMarkup = '<a id="infowindow-1" class="clickeventvialive">click me</a>';
        marker.bindInfoWindowHtml(infoWindowMarkup);
        gmap.addOverlay(marker);

        $('.clickeventvialive').live('click', function () {
            alert('Are you Internet Exploder??');
        });
    });
</script>

</head>
<body>
    <div id="gmap"></div>
</body>
</html>
  • 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-17T16:48:51+00:00Added an answer on May 17, 2026 at 4:48 pm

    There are two ways of solving that one with jquery another using old skool javascript onclick.

    In the jQuery method binding the event AFTER the info window is shown and the element created seems to solve the problem:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title></title>
            <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA" type="text/javascript">
            </script>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript">
            </script>
            <style type="text/css">
                #gmap {
                    height: 450px;
                    width: 350px;
                }
    
    
            </style>
            <script type="text/javascript">
                var gmap;
                var sampleLatLon = new GLatLng(37.4419, -122.1419);
                var sampleIcon = new GIcon(G_DEFAULT_ICON);
    
                $(document).ready(function(){
    
                    // Google maps setup
                    $(window).unload(function(){
                        GUnload();
                    });
                    var gmap = new GMap2(document.getElementById("gmap"));
                    gmap.setCenter(sampleLatLon, 13);
                    gmap.setUIToDefault();
    
                    // Marker and InfoWindow setup
                    var marker = new GMarker(sampleLatLon, {
                        icon: sampleIcon
                    });
    
                    //marker.bindInfoWindowHtml(infoWindowMarkup);
    
                    GEvent.addListener(marker, "click", function(){
                        var infoWindowMarkup = '<div class="container"><a id="infowindow-1" class="clickeventvialive">click me</a></div>';
                        gmap.openInfoWindowHtml(sampleLatLon, infoWindowMarkup, {
                            "onOpenFn": function(){
                             $(".clickeventvialive").bind("click", function (){alert("hello")});
                            }
                        });
    
                    });
    
    
    
                    gmap.addOverlay(marker);
    
                });
            </script>
        </head>
        <body>
            <div id="gmap">
            </div>
        </body>
    </html>
    

    or the old skool method where you can simply add onclick handler to to your link HTML:

    var infoWindowMarkup = '<a id="infowindow-1" onclick=alert("Old Skool") class="clickeventvialive">click me</a>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the technique described here to register string values on the JNDI tree
I want fetch the parameters of my hard disk. Using the technique described here
I'm using the CSS Sticky Footer technique described here, and have it sort of
In my current project, I'm producing weekly releases. I've been using the technique described
In C# is there a technique using reflection to determine if a method has
I'm monkey patching a package using a technique given at the beginning of How
Is it possible to reflectively instantiate a generic type in Java? Using the technique
First is there any technique for using Action Script for recording sound from microphone?
I'm currently using the usual technique in my Makefile to install individual files: install:
I've decided to attempt using the double submitted cookies technique to attempt to prevent

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.