Title: Initialize Google map with javascript.
Last modified: September 4, 2020

---

# Initialize Google map with javascript.

 *  Resolved [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/initialize-google-map-with-javascript/)
 * Is there a function I can use to initialize the map after duplicating it?
    I’m
   using a repeater, to duplicate any field in contact form 7. Is there a function
   I should call after duplication the field in order for it to appear properly?
 * Something like: `cf7GoogleMap.init()`?
    -  This topic was modified 5 years, 8 months ago by [Jules Colle](https://wordpress.org/support/users/jules-colle/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finitialize-google-map-with-javascript%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/initialize-google-map-with-javascript/#post-13374414)
 * > I’m using a repeater, to duplicate any field in contact form 7.
 * that’s a good question. had to tweak the front-end code a little.
 * with v1.7.3 you can now do something like,
 *     ```
       $cloned_map = $map_container.clone();
       //initCF7googleMap() can be chained, but will return false if the element is not a .cf7-google-map-container element.
       if($cloned_map.is('.cf7-google-map-container')) $cloned_map.initCF7googleMap();
       ```
   
 * the plugin is also fully compatible with the [repetitive field constructs](https://www.youtube.com/watch?v=mcC36e69-eM)
   available with the [Smart grid-layout](https://wordpress.org/plugins/cf7-grid-layout/)
   plugin.
    -  This reply was modified 5 years, 8 months ago by [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/).
 *  Thread Starter [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/initialize-google-map-with-javascript/#post-13443437)
 * Thanks Aurovrata! This works nicely.
 * For anyone interested, the code I ended up with, when using CF Pro repeater is
   the following:
 *     ```
       jQuery('form').on('wpcf7cf_repeater_added', function(e) {
         // init map
         $newGMap = jQuery('.cf7-google-map-container', jQuery(e.target));
         if($newGMap.initCF7googleMap) {
           $newGMap.initCF7googleMap();
         }
       });
       ```
   

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

The topic ‘Initialize Google map with javascript.’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cf7-google-map.svg)
 * [Contact Form 7 extension for Google Map fields](https://wordpress.org/plugins/cf7-google-map/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-google-map/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-google-map/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-google-map/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-google-map/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-google-map/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/initialize-google-map-with-javascript/#post-13443437)
 * Status: resolved