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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:28:05+00:00 2026-05-25T21:28:05+00:00

How can I reference a google map in another script? On my WordPress page,

  • 0

How can I reference a google map in another script? On my WordPress page, I load javascript (a) that builds my map, and jQuery script (b). I need to figure out some way passing a reference to the map to script (b). The problem is that the map is created inside a function in script (a).

In script (a), I’ve got:

function map_maker_js( args ) {
var map = new google.maps.Map(document.getElementById( args['id'] ), myOptions);

//code for building map continues
}

In script (b):

jQuery.noConflict();

jQuery(document).ready(function($) { 

//say I need the map's bounds
//how can I access map, in order for this to work: 
map.getBounds();

}

I saw this stackoverflow solution, but I couldn’t get it to work.

  • 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-25T21:28:05+00:00Added an answer on May 25, 2026 at 9:28 pm

    stick it in the global namespace.

    function map_maker_js( args ) {
         window.map = new google.maps.Map(
              document.getElementById( args['id'] ), myOptions);
    
         //code for building map continues
    }
    

    jquery

    jQuery.noConflict();
    
    jQuery(document).ready(function($) { 
        window.map.getBounds();
    }
    

    but make sure map_maker_js finishes running first.

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

Sidebar

Related Questions

I read somewhere in Google's reference (and I can not find it again) that
Hi I know I can load the javascript ajax libraries from jquery and other
As title, I searched official google maps api reference and other site, I can't
How do I create a resource that I can reference and use in various
I need to define a weak reference Map, whose value is a Set. I
I am writing an HTML form that uses a google map, but to reduce
In my Google Maps application I can place markers on the map, and I
I can only post one link so here is a reference page with corresponding
In google map's reference I found the MVCObject,it provide some cool function. But I
i can reference link with specific id with following code $(document).ready(function(){ $(a#example_link_id).click(function(event){ var url

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.