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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:46:10+00:00 2026-06-03T15:46:10+00:00

I have the following code in a Google map script… <a class=’btn btn-modal’ data-target=’popup.html’>Go</a>

  • 0

I have the following code in a Google map script…

<a class='btn btn-modal' data-target='popup.html'>Go</a>

outside of the script the link works and runs the function $('.btn-modal').click(function() { (on the page) but in the infoWindowHtml it does not.

anyone know why you cannot run script on my page from within goggle maps?

Script I want to be run at the top of the page Google maps is on…

$(document).ready(function () {
    // Support for AJAX loaded modal window
    $('.btn-modal').click(function () {
        $.get($(this).attr('data-target'), function (data) {
            $('#modal').html(data);
            $('#modal').modal('show');
        }, 'html');
    });
});

Google map extract showing link

map = new google.maps.Map(document.getElementById("map"), options);
// Create an Array for the Markers
var markers = [];
var latLng = new google.maps.LatLng(#local.poiLat()#, #local.poi()#);
var iconImg = '/assets/images/pin-50.png';
var marker = new google.maps.Marker({
    icon: iconImg,
    draggable: true,
    position: latLng,
    title: '#left(local.poiTxt(),60)#'
});
// Action Listener for the Marker
google.maps.event.addListener(marker, "click", function (event) {
    var area = this.get('location');
    var infoWindowHtml = "<a class='btn btn-modal' data-target='popup.html'>Go</a>";
    infoWindow.setContent(infoWindowHtml);
    infoWindow.open(map, this);
});
  • 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-03T15:46:11+00:00Added an answer on June 3, 2026 at 3:46 pm

    The infowindow isnt part of the DOM on load … so you need to use on instead of click :

    $(document).on('click','.btn-modal',function() {
    

    Where document is a parent element present on load – perhaps the id of the div for the map … so

    $('#map').on('click','.btn-modal',function() {
    

    docs for .on() here

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

Sidebar

Related Questions

I'm using jQuery version 1.7.1 from Google CDN and have the following code: $(menuInstance).delay(2000).removeClass('loading').html(ul);
i have the following code to update a google map: function updateit(c1,c2){ alert(c1+-+c2); //
I have the following code( to draw a map using google map API V3):
I have the following code which creates a map on a content page. <script
I have the following code: <!DOCTYPE html> <html> <head> <script src=http://code.jquery.com/jquery-latest.min.js></script> <meta name=viewport content=initial-scale=1.0,
Let's say I have the following code in Google App Engine: from urllib import
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,
I have the following code in my .Zshrc function google; { $VIEW http://www.google.com/search?q='url-encode ${(j:
I have come across the following link: http://code.google.com/p/a-star/source/browse/trunk/java/PathFinder.java?r=8 I have got the code working
I have following code class User attr_accessor :name end u = User.new u.name =

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.