Title: Trigger popup builder using javascript
Last modified: September 15, 2020

---

# Trigger popup builder using javascript

 *  Resolved [dhrvatin](https://wordpress.org/support/users/dhrvatin/)
 * (@dhrvatin)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/)
 * I’m using the Interactive World Maps plugin. There is a section to use custom
   javascript to trigger a popup builder post that was previously created when a
   visitor clicks on the map. I’ve looked online and in this forum but can’t seem
   to find any code that I can use and adjust for this.

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

 *  [Sygnoos Support](https://wordpress.org/support/users/sygnoossupport/)
 * (@sygnoossupport)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13413667)
 * Dear [@dhrvatin](https://wordpress.org/support/users/dhrvatin/) ,
 * Thanks for the message!
    Can you, please, set on click event for the popup and
   then insert the given code into that section? Here is the code:
 *     ```
       var popupObj = SGPBPopup.createPopupObjById(your_second_popup_id_here);
       popupObj.prepareOpen();
       ```
   
 * Let us know if that helped, please.
 *  Thread Starter [dhrvatin](https://wordpress.org/support/users/dhrvatin/)
 * (@dhrvatin)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13415580)
 * Hello,
 * I tried putting the popup id in the js code your provided and it isn’t working.
   I’m getting a “real-estate:900 Uncaught ReferenceError: SGPBPopup is not defined”
   error in the browser console.
 * I’ve reached out to the map plugin support to see if they can help.
 *  [Sygnoos Support](https://wordpress.org/support/users/sygnoossupport/)
 * (@sygnoossupport)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13418797)
 * Dear [@dhrvatin](https://wordpress.org/support/users/dhrvatin/) ,
 * Thanks for getting back to us!
    Can you, please, put that popup on the test page
   and send it to us so we can check that live? Will be looking forward to hearing
   from you soon.
 *  Thread Starter [dhrvatin](https://wordpress.org/support/users/dhrvatin/)
 * (@dhrvatin)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13419754)
 * I would be more than happy to schedule a call and screenshare if you’re willing
   to. I hardly know js as you can tell 🙂
 * [test webpage link](http://myelderlife.com/elderlifefinancial/TestSite/real-estate)
 * I added a test popup link above the map, a version of this popup is what we want
   to pop up once someone clicks on any state (region) on the map.
 * Here is a link to an image of the settings of the map – [map settings](https://elderlifefinancial.com/interactive_world_maps_settings.jpg)
 * Here is a ling to an image of the js custom action details – [js details](https://elderlifefinancial.com/interactive_world_maps_js_info.jpg)
 * Here is the response from the Interactive World Maps plugin support
 * “Hi Drew
    Looking at this code and what you’ve done so far, I believe each of
   your states, in the action value field, would only have the ID of the popup, 
   so numbers like 8599 it seems. Then you custom code would be:
 * var popupObj = SGPBPopup.createPopupObjById(parseInt(value));
    popupObj.prepareOpen();
 * Basically replacing your_second_popup_id_here from the example code with the 
   integer provided in the action value of the clicked action.
    From the side of
   my plugin that would be all you need. Clicking the state will trigger that code.
   But if you’re getting that error, then it means the popup code is not loading.
   For this particular error you’ll need to ask the popup developers again. Maybe
   it only loads the popup code if it exists on the URL somehow or is hidden in 
   the page?”
 *  Thread Starter [dhrvatin](https://wordpress.org/support/users/dhrvatin/)
 * (@dhrvatin)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13420196)
 * Hello Sygnoos Support,
 * I was able to get this working how we wanted. Thank you very much for the quick
   help.

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

The topic ‘Trigger popup builder using javascript’ is closed to new replies.

 * ![](https://ps.w.org/popup-builder/assets/icon-128x128.gif?rev=2698840)
 * [Popup Builder - Create highly converting, mobile friendly marketing popups.](https://wordpress.org/plugins/popup-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popup-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popup-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/popup-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popup-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popup-builder/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [onclick](https://wordpress.org/support/topic-tag/onclick/)
 * [trigger](https://wordpress.org/support/topic-tag/trigger/)

 * 5 replies
 * 2 participants
 * Last reply from: [dhrvatin](https://wordpress.org/support/users/dhrvatin/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/trigger-popup-builder-using-javascript/#post-13420196)
 * Status: resolved