<?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 Re: Trying to target the form &amp;quot;submit&amp;quot; button. in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429441#M22577</link>
    <description>&lt;P&gt;I'll give it a shot, thanks so much!!!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Apr 2021 13:03:23 GMT</pubDate>
    <dc:creator>nlafakis</dc:creator>
    <dc:date>2021-04-20T13:03:23Z</dc:date>
    <item>
      <title>Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/428815#M22561</link>
      <description>&lt;P&gt;I know this probably isn't the right place for this, but I see there are other FAQ type questions here so I thought it's as good a place as any? Moderators feel free to delete or move if need be of course. I understand, cleanliness, godliness, etc...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm using a form on a page and above the form is some urgency copy, "Fill out the form to recieve your promotional offer now!" type deal. So what I'm trying to do or would like to do, is to target the form "Submit" button with .js so that I can make that header text disappear. So basically, target the .hs-button, and say that when it's clicked, to make the div which contains the "Fill out form to..." disappear.&lt;BR /&gt;&lt;BR /&gt;I've tried several methods of attaching a command to the button but no matter how I target it, it simply won't perform the .js action. Trying to figure out what I'm doing wrong here. Code is below:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;HTML:&lt;/STRONG&gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;div class="form_container"&amp;gt;&lt;BR /&gt;&amp;lt;div class="header" id="header"&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;This is the header text for the form&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;h3&amp;gt;THAT NEEDS TO DISAPPEAR&amp;lt;/h3&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="form"&amp;gt;&lt;BR /&gt;&amp;lt;script charset="utf-8" src="//js.hsforms.net/forms/v2.js" type=&lt;BR /&gt;"text/javascript"&amp;gt;&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;hbspt.forms.create({&lt;BR /&gt;region: "na1",&lt;BR /&gt;portalId: "someplacewithnumbers",&lt;BR /&gt;formId: "xyzidentifyingthingamajigofcodethatgoeshere"&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;The .js code:&lt;/STRONG&gt;&lt;BR /&gt;function toggleText(){&lt;BR /&gt;var x = document.getElementByClassName(".hs-button primary large");&lt;BR /&gt;if (x.style.display === "none") {&lt;BR /&gt;x.style.display = "block";&lt;BR /&gt;} else {&lt;BR /&gt;x.style.display = "none";&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 20:20:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/428815#M22561</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-16T20:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429137#M22562</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/175537"&gt;@nlafakis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adding &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt; to this thread.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I feel like we need a bit more detail, though...&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 15:59:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429137#M22562</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2021-04-19T15:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429156#M22563</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13982"&gt;@dennisedson&lt;/a&gt;&amp;nbsp;!,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for getting back to me! Ok, so this is for a registration form page. I'm using a different program to build the landing page, and I have the hubspot form within a container on the page. So you could think of it as:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div (form background box)&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;h1&amp;gt;Some Headline Text Here&amp;lt;/h1&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div (hs-form)&amp;gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So I'm trying to talk to the hs-form Submit button, and listen for when it's activated to make the "Some Headling Text Here" or &amp;lt;h1&amp;gt; copy, disappear or display: none; as it were. I know it's a SUPER long-shot and it's probably not even possible right? Because since it's a 3rd party page loading an exterior form, can it listen for it when the form is loaded on the page? Maybe the .js has to go at the footer so the form is already loaded? If it's not possible or seems not possible, I'm fine with that too, just wondering &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 16:26:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429156#M22563</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-19T16:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429199#M22566</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/175537"&gt;@nlafakis&lt;/a&gt;, The form will be one of the last things to load.&amp;nbsp; You could try adding it to the onFormReady callback function as described on this page: &lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank"&gt;https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 18:42:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429199#M22566</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2021-04-19T18:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429441#M22577</link>
      <description>&lt;P&gt;I'll give it a shot, thanks so much!!!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 13:03:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429441#M22577</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-20T13:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429486#M22580</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/175537"&gt;@nlafakis&lt;/a&gt; If you wanna target after form submission you'll want to use &lt;SPAN class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_raw_html" data-hs-cos-general-type="widget" data-hs-cos-type="raw_html"&gt;&lt;EM&gt;onFormSubmitted, &lt;/EM&gt;this way it'll hide the header if the submission is a success (ie when the form submitted message appears)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;hbspt.forms.create({
  portalId: '',
  formId: '',
  onFormSubmitted: function($form) {
    document.getElementById('header').style.display = "none";
  } 
});        &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:13:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429486#M22580</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2021-04-20T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429593#M22599</link>
      <description>&lt;P&gt;Alyssa,&lt;/P&gt;&lt;P&gt;Thank you so much! I will give this a try first since it seems to be the quicker solution, if not then I'll give Dennis' linked method a try and let you guys know which worked! Thanks again, really love this community and how responsive it is!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 17:56:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429593#M22599</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-20T17:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429594#M22600</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/91608"&gt;@alyssamwilie&lt;/a&gt; 's solution should be the correct one.&amp;nbsp; (it is also listed on that link I provided)&lt;/P&gt;
&lt;P&gt;onFormReady loads your function after the form is ready, onFormSubmitted loads it after the form has been submitted which is what you are looking to do.&amp;nbsp; Thank Alyssa for correcting me &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 18:03:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429594#M22600</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2021-04-20T18:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429925#M22615</link>
      <description>&lt;P&gt;Ok, so I've tried&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/91608"&gt;@alyssamwilie&lt;/a&gt;'s method. And that&amp;nbsp;&lt;STRONG&gt;really&lt;/STRONG&gt; does seem like it should work...but for w/e reason I can't get it to work :(. I don't know if I need to be running a separate script with it or not. I don't know if this is allowed will even work, but this is the fiddle I'm testing it in:&amp;nbsp;&lt;A href="https://jsfiddle.net/nlafakis/0wfvgjkn/232/" target="_blank"&gt;https://jsfiddle.net/nlafakis/0wfvgjkn/232/&lt;/A&gt;. If that kinda thing isn't allowed I totally get it and no prob with removing.&lt;BR /&gt;&lt;BR /&gt;So I'm sure you're going to find the code "sloppy," and that's because I'm not a veteran with html or css, but I'm fairly good at reverse engineering code, so I do a lot of copy/paste.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried the onFormSubmitted method&lt;BR /&gt;I've tried the onFormSubmit method&lt;/P&gt;&lt;P&gt;I've tried document.getElementById('header').style.display = "none"&lt;/P&gt;&lt;P&gt;I've tried document.getElementByClassName('header').style.display = "none"&lt;/P&gt;&lt;P&gt;I've tried these combinations with: getElementById("header") as opposed to ('header')&lt;/P&gt;&lt;P&gt;I've tried getElementById('header').style.visibility = "hidden"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, no luck &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 14:21:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/429925#M22615</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-21T14:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430058#M22628</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/175537"&gt;@nlafakis&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;This is the is the correct one:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;document.getElementById("header").style.display = "none";&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Make sure you have jquery loaded &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 18:15:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430058#M22628</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2021-04-21T18:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430060#M22629</link>
      <description>&lt;P&gt;I updated that fiddle.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

  &amp;lt;head&amp;gt;
  &amp;lt;/head&amp;gt;

  &amp;lt;body&amp;gt;
    &amp;lt;div class="form_container"&amp;gt;
      &amp;lt;div class="header" id="header"&amp;gt;
        &amp;lt;p&amp;gt;This is the header text for the form&amp;lt;/p&amp;gt;
        &amp;lt;h3&amp;gt;THAT NEEDS TO DISAPPEAR&amp;lt;/h3&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="form"&amp;gt;
        &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({
            region: "na1",
            portalId: "3436466",
            formId: "223015bd-07c7-4a06-84f1-1056b6e50bb6",
            onFormSubmitted: function($form) {
              document.getElementById("header").style.display = "none";
            }

          });

        &amp;lt;/script&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Apr 2021 18:16:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430060#M22629</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2021-04-21T18:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to target the form "submit" button.</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430129#M22633</link>
      <description>&lt;P&gt;I could kiss you right now sir, but you'll have to settle for virtual hugs&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you &lt;STRONG&gt;SO&lt;/STRONG&gt; much to everyone that offered help, you guys are awesome and &lt;STRONG&gt;this community is seriously amazing!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 21:12:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Trying-to-target-the-form-quot-submit-quot-button/m-p/430129#M22633</guid>
      <dc:creator>nlafakis</dc:creator>
      <dc:date>2021-04-21T21:12:06Z</dc:date>
    </item>
  </channel>
</rss>

