# Hubspot shortcode issue with Elementor Pop-up

**URL:** <https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985>\
**Category:** CMS Development\
**Tags:** forms\
**Created:** [March 11, 2022, 1:39pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985 "2022-03-11T13:39:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchafei](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rchafei/32/192598_2.png) [@rchafei](https://community.hubspot.com/u/rchafei)\
**Post date:** [March 11, 2022, 1:39pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/1 "2022-03-11T13:39:29Z")

</div>

We have the Hubspot plugin installed and we use shortcode to display the form using the Elementor Page Builder. We are having issues with 2 iframes generated when we use the inspect element on the browser.

 ![rchafei_0-1647005851482.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/6/261c8d575172a525a0a94806fe5b1978ac10a890.png)

It generates two id’s of the iFrame tag.  
Hs-form-iframe-0  
Hs-form-iframe-1

We use the Elementor Pop-up to display the shortcode.

How can we get rid of the white space on embed forms?

Thank you

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 14, 2022, 7:20pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/2 "2022-03-14T19:20:39Z")

</div>

@Anton ever deal with this 🤔?

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [March 15, 2022, 7:36am UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/3 "2022-03-15T07:36:31Z")

</div>

Hi @rchafei,

could you please provide a “preview” link to this page?  
Seems like a CSS misbehavior.

You could try to embed the form without CSS styling by modifing the embed code as this in the mean time:

original code:

```lia-code-sample
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
 hbspt.forms.create({
	region: "na1",
	portalId: "XXXXXXX",
	formId: "XXX-XXX-XXX"
});
</script>

```

modified code:

```lia-code-sample
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
 hbspt.forms.create({
	region: "na1",
	portalId: "XXXXXXX",
	formId: "XXX-XXX-XXX",
 css:''
});
</script>

```

by adding

`css:''`

to the embed code you’re disabling the default CSS from HubSpot and the CSS should be grabbed from your WordPress theme (you might need to add/modify it slightly)

best,

Anton

---

<div class="post-metadata">

**Author:** ![dev\_rico](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dev\_rico](https://community.hubspot.com/u/dev_rico)\
**Post date:** [March 17, 2022, 11:28am UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/4 "2022-03-17T11:28:30Z")

</div>

Hello Anton,  
I’m Rico and I’m one of his developers on that site. We actually tried that solution and still, we are having the extra white spaces issue on the pop-up.  
Here’s how I did it:

 ![image.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/6/6e81611051a16bd3d6995986a8025308ade965ff.png)

and here’s the result:

 ![image (1).png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/1/c1623f9dce30038cde34bb55281c33973b986415.png)

To further expand this, when we use the shortcode from the Hubspot plugin, we are getting javascript error when looking at the console tab from inspect element. See here:

 ![image (2).png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/9/f9e2f5959679e12b58df8f9c38cddf8065980b4f.png)

We have two caching system on the site. One is from the wpengine and one is from the WPRocket.  
I think it’s worth a try if we can have ways to exclude the javascript files from the Hubspot plugin to the WPRocket settings so that it will not be cached. What do you think?  
Looking forward to your solution.

---

<div class="post-metadata">

**Author:** ![OshriHumanz](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@OshriHumanz](https://community.hubspot.com/u/OshriHumanz)\
**Post date:** [July 5, 2022, 2:20pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/5 "2022-07-05T14:20:23Z")

</div>

We are having the exact same issue.

This is a bug - and the worst part that if we have another form in the page - the one that should be in the popup is injecting itself to the form on the page.

Loading the form by html and not a shortcode on elementor popup loads an iframe with an empty body.

How can we fix this?

---

<div class="post-metadata">

**Author:** ![AaaBbb](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@AaaBbb](https://community.hubspot.com/u/AaaBbb)\
**Post date:** [August 12, 2022, 9:52am UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/6 "2022-08-12T09:52:36Z")

</div>

So guys, care to post the solution? I’m having the same issue. White space in HTML code block.  
Please help me sort this out! Thank you!

---

<div class="post-metadata">

**Author:** ![bartt](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@bartt](https://community.hubspot.com/u/bartt)\
**Post date:** [August 14, 2023, 3:14pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/7 "2023-08-14T15:14:38Z")

</div>

Hi @rchafei , I had the same issue, so it’s still a going on. But here is a youtube video that helped me: [https://www.youtube.com/watch?v=WA9v\_YrylIU](https://www.youtube.com/watch?v=WA9v_YrylIU)  
It basically wraps this code arround the script:

```auto
jQuery(window).load(function() {
	jQuery.each( elementorFrontend.documentsManager.documents, ( id, document ) => {
		if ( document.getModal ) { // It's a popup document
			document.getModal().on( 'show', () => {
				console.log( 'Run your script here' );
			} );
		}
	});
});

```

---

<div class="post-metadata">

**Author:** ![joaomgarcia](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@joaomgarcia](https://community.hubspot.com/u/joaomgarcia)\
**Post date:** [December 5, 2023, 9:32pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/8 "2023-12-05T21:32:39Z")

</div>

Perfect, thanks!

---

<div class="post-metadata">

**Author:** ![ILinder](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@ILinder](https://community.hubspot.com/u/ILinder)\
**Post date:** [November 13, 2023, 5:47pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/9 "2023-11-13T17:47:43Z")

</div>

I’m dealing with the same issue. This is compounded by a custom post type using an Advanced Custom Field for pop-up content. It will work with a Pardot iFrame but not with Hubspot JS. I’ve tried to insert even one form JS manually via PHP and still doesn’t load. I’ve tried adding the first JS library script tag seperately so it’s there on page load and doesn’t work either. Incidentally we also use WP Rocket and also have Godaddy for caching. But even locally on my laptop I can’t get the form to show.

---

<div class="post-metadata">

**Author:** ![ILinder](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@ILinder](https://community.hubspot.com/u/ILinder)\
**Post date:** [December 5, 2023, 10:06pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/10 "2023-12-05T22:06:47Z")

</div>

I was having this trouble. I tried many solutions but at the end of the day I think it was both the wordpress site caching via a plugin, [godaddy.com](http://godaddy.com) caching (with managed wordpress) and then possibly cloudflare caching. I came back after a weekend and suddenly the hubspot shortcodes worked in the Elementor Pro popups for corporate website. However, I had to use the Wordpress Hubspot section in admin to get the shortcodes.  
The main point, try clearing any cache you can.

---

<div class="post-metadata">

**Author:** ![ILinder](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@ILinder](https://community.hubspot.com/u/ILinder)\
**Post date:** [December 5, 2023, 10:19pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/11 "2023-12-05T22:19:30Z")

</div>

If you go to this page on our site, click the ebooks filter/button and click one, these are hubspot shortcodes for forms. [Learning Center | Speedeon](https://speedeondata.com/learning-center/)  
Nothing special going on, but apparently until the various caches were cleared and purged it would show no shortcodes for hubspot in the elementor pro pop-ups.

---

<div class="post-metadata">

**Author:** ![RAnand80](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RAnand80](https://community.hubspot.com/u/RAnand80)\
**Post date:** [February 14, 2024, 8:36pm UTC](https://community.hubspot.com/t/hubspot-shortcode-issue-with-elementor-pop-up/52985/12 "2024-02-14T20:36:36Z")

</div>

I had the same problem, in the end I decided to not use Elementor Popup and installed Popup maker plugin.

That worked perfect with hsforms.

If anyone having this issue, simply use popup maker plugin and it will solve the form on popup
