Title: Bug With JS Store Locator Code
Last modified: June 20, 2019

---

# Bug With JS Store Locator Code

 *  Resolved [James Jones](https://wordpress.org/support/users/jamesjonesphoenix/)
 * (@jamesjonesphoenix)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/bug-with-js-store-locator-code/)
 * Hi there,
 * I encountered a bug with your plugin. It’s related to the theme I’m using which
   obviously isn’t your problem, but please read carefully because you do have a
   problem in there somewhere.
 * Clicking on some tabs supplied by my theme unrelated to your plugin breaks the
   Javascript. The actual js error is:
 * > MYMAP.modernStoreLocator.element is undefined
 * The tabs have class `.nav-tabs`. So when I click the link `InitMap()` is invoked
   as per the `wpgmaps.js` line `jQuery('body').on('click', '.nav-tabs li a', function(
   event, ui) { InitMap(); });`.
 * The actual js line triggering the error is `MYMAP.modernStoreLocator.element.
   index = 1;` in line 293 of `wpgmaps.js`.
 * The thing is I have Store Locator switched **off** in the options. This code 
   block should not be getting executed as far as I can see. I don’t understand 
   why the variable `MYMAP.modernStoreLocator` exists when I have the Store Locator
   switched off but I didn’t trawl through the code to find out.
 * I fixed it for myself by changing line 290 from `if(MYMAP.modernStoreLocator)`
   to `if(MYMAP.modernStoreLocator && MYMAP.modernStoreLocator.element)`. The map
   continues working fine for myself. The actual fix is somewhere along those lines,
   but maybe less hacky.
 * Hope that helps.
    Cheers, James
    -  This topic was modified 6 years, 11 months ago by [James Jones](https://wordpress.org/support/users/jamesjonesphoenix/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-with-js-store-locator-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [perryrylance](https://wordpress.org/support/users/perryrylance/)
 * (@perryrylance)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/bug-with-js-store-locator-code/#post-11670704)
 * Hi James
 * Thank you very much for the comprehensive report.
 * This is confusing as your version of WP Google Maps on this site appears to be
   up to date, however based on what you’ve said, your JS doesn’t match ours.
 * With that said, we’ve added an additional check for that element as per your 
   advice, I think that’s the best way moving forward.
 * We’ll need to test this to see that it doesn’t have any adverse affects elsewhere,
   however I think it’s quite reasonable to say we can keep this in.
 * Is there anything else we can help you with?
 * Kind regards
    – Perry
 *  Thread Starter [James Jones](https://wordpress.org/support/users/jamesjonesphoenix/)
 * (@jamesjonesphoenix)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/bug-with-js-store-locator-code/#post-11671901)
 * You’re most welcome and thanks for listening.
 * I was using version 7.11.31. Your plugin recently updated to 7.11.32. If that
   file changed between versions it’d probably explain the discrepancy. Otherwise
   I’m not sure why.
    -  This reply was modified 6 years, 11 months ago by [James Jones](https://wordpress.org/support/users/jamesjonesphoenix/).

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

The topic ‘Bug With JS Store Locator Code’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [James Jones](https://wordpress.org/support/users/jamesjonesphoenix/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/bug-with-js-store-locator-code/#post-11671901)
 * Status: resolved