<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Form embed not rendering on jQuery .after() in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Form-embed-not-rendering-on-jQuery-after/m-p/406163#M20937</link>
    <description>&lt;P&gt;I'm trying to develop a workaround for a site but I'm not sure if it's viable or not at this point and currently what I have doesn;t seem to be working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We were hoping to put a form ID's into href attirbutes within a certain string which would then be used to inject the HubSpot form e.g. (&amp;lt;a href="#hs-embed:FORMIDHERE"&amp;gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The jquery would find these hrefs and take the relevant form ID and inject the embed code after the link. e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$(window).load(function(){
  $('a[href*="#hs-embed"]').each(function() {
    $(this).after('&amp;lt;!--[if lte IE 8]&amp;gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;![endif]--&amp;gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;script&amp;gt;hbspt.forms.create({portalId: "2650439",formId: "' + formID + '",onFormReady: function($form) {console.log("ready");}});&amp;lt;/script&amp;gt;');
  });
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue I'm having is the form is currnetly not rendering, even if I just palce the ID as is copied from embed code for testing purposes. The onFormReady is outputting the console.log just no form fields are appearing.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 12:39:10 GMT</pubDate>
    <dc:creator>benji_thecroc</dc:creator>
    <dc:date>2021-02-04T12:39:10Z</dc:date>
    <item>
      <title>Form embed not rendering on jQuery .after()</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Form-embed-not-rendering-on-jQuery-after/m-p/406163#M20937</link>
      <description>&lt;P&gt;I'm trying to develop a workaround for a site but I'm not sure if it's viable or not at this point and currently what I have doesn;t seem to be working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We were hoping to put a form ID's into href attirbutes within a certain string which would then be used to inject the HubSpot form e.g. (&amp;lt;a href="#hs-embed:FORMIDHERE"&amp;gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The jquery would find these hrefs and take the relevant form ID and inject the embed code after the link. e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$(window).load(function(){
  $('a[href*="#hs-embed"]').each(function() {
    $(this).after('&amp;lt;!--[if lte IE 8]&amp;gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;![endif]--&amp;gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;script&amp;gt;hbspt.forms.create({portalId: "2650439",formId: "' + formID + '",onFormReady: function($form) {console.log("ready");}});&amp;lt;/script&amp;gt;');
  });
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue I'm having is the form is currnetly not rendering, even if I just palce the ID as is copied from embed code for testing purposes. The onFormReady is outputting the console.log just no form fields are appearing.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 12:39:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Form-embed-not-rendering-on-jQuery-after/m-p/406163#M20937</guid>
      <dc:creator>benji_thecroc</dc:creator>
      <dc:date>2021-02-04T12:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Form embed not rendering on jQuery .after()</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Form-embed-not-rendering-on-jQuery-after/m-p/406282#M20943</link>
      <description>&lt;P&gt;Solved it like so&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$(window).load(function(){
    $('a[href*="#hs-embed"]').each(function() {    
      let formRef = $(this).attr('href').split('=')[1];
      console.log(formRef);
      $(this).after('&amp;lt;div class="js-form-container" data-formid="' + formRef + '"&amp;gt;&amp;lt;div class="inner-wrap"&amp;gt;&amp;lt;h4&amp;gt;Speak to a member of our team&amp;lt;/h4&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;');

      hbspt.forms.create({
        portalId: "PORTAL ID HERE",
        formId: formRef,
        target: '.js-form-container[data-formid="' + formRef + '"] .inner-wrap'
      });
      
    });
  });&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Feb 2021 16:10:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Form-embed-not-rendering-on-jQuery-after/m-p/406282#M20943</guid>
      <dc:creator>benji_thecroc</dc:creator>
      <dc:date>2021-02-04T16:10:44Z</dc:date>
    </item>
  </channel>
</rss>

