Title: javascript errors: undefined
Last modified: March 15, 2017

---

# javascript errors: undefined

 *  Resolved [En18Zone](https://wordpress.org/support/users/en18zone/)
 * (@en18zone)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/)
 * Hi
 * I’m having some javascript issue kindly help me narrow down the problem
 *     ```
       Uncaught TypeError: Cannot read property 'firstChild' of undefined
           at Object._.ng (js:85)
           at new sg (js:86)
           at Object.MYMAP.init (wpgmaps.js:108)
           at InitMap (wpgmaps.js:15)
           at HTMLDocument.<anonymous> (wpgmaps.js:33)
           at i (jquery.js:2)
           at Object.fireWith [as resolveWith] (jquery.js:2)
           at Function.ready (jquery.js:2)
           at HTMLDocument.K (jquery.js:2)
       wpgmaps.js:162 Uncaught TypeError: Cannot read property 'setCenter' of null
           at wpgmaps.js:162
       ```
   
 * P.s Thanks for the awesome plugin.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Jarryd Long](https://wordpress.org/support/users/jarryd-long/)
 * (@jarryd-long)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8923161)
 * Hi there
 * Thank you for getting in touch with us and for your kind words!
 * Please advise what version of the plugin you currently have installed? Does this
   occur when loading the map on the page, or while adding a marker?
 *  Thread Starter [En18Zone](https://wordpress.org/support/users/en18zone/)
 * (@en18zone)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8923429)
 * Thanks for the reply. I’m using Version 6.4.03 of the plugin and the map loads
   fine but i’m getting those errors on the console.
 * On further inspection i noticed those errors appear only when i use php conditionals
   to load the map on only a specific page.
 *  [Jarryd Long](https://wordpress.org/support/users/jarryd-long/)
 * (@jarryd-long)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8936531)
 * Hi there
 * Would you mind sending me a sample of your PHP code so that I can look further
   into this for you, and possibly try run the same code on my side to find a solution
   to work around this?
 *  Thread Starter [En18Zone](https://wordpress.org/support/users/en18zone/)
 * (@en18zone)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8944843)
 * I’m not using any advanced php as i’m a beginner myself
 *     ```
       <?php if( is_page( 'contact' ) ): ?>
           [Map Shortcode]
       <?php endif; ?>
       ```
   
 *  [Jarryd Long](https://wordpress.org/support/users/jarryd-long/)
 * (@jarryd-long)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8945833)
 * Hi there
 * Would you mind trying the following PHP code and let me know if this helps at
   all?
 *     ```
       <?php 
       if( is_page( 'contact' ) ):
           echo do_shortcode("[Map Shortcode]");
       endif; 
       ?>
       ```
   
 *  Thread Starter [En18Zone](https://wordpress.org/support/users/en18zone/)
 * (@en18zone)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8946135)
 * That fixes it, thank you very much for your help and for taking the time to look
   at this.
 *  [Jarryd Long](https://wordpress.org/support/users/jarryd-long/)
 * (@jarryd-long)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8950186)
 * Only a pleasure! So glad to hear this helped.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘javascript errors: undefined’ is closed to new replies.

 * ![](https://ps.w.org/wp-google-maps/assets/icon-256x256.png?rev=3058363)
 * [WP Go Maps - Google Maps, OpenStreetMap, Leaflet Map](https://wordpress.org/plugins/wp-google-maps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-google-maps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-google-maps/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-google-maps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-google-maps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-google-maps/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Jarryd Long](https://wordpress.org/support/users/jarryd-long/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/javascript-errors-undefined/#post-8950186)
 * Status: resolved