<?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: Onlcick is stripped from my code in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204370#M7976</link>
    <description>&lt;P&gt;I also found that comments inside my JS caused HubSpot&amp;nbsp;to make the entire function&amp;nbsp;a comment &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 20:22:33 GMT</pubDate>
    <dc:creator>fayettec</dc:creator>
    <dc:date>2018-08-29T20:22:33Z</dc:date>
    <item>
      <title>Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204354#M7965</link>
      <description>&lt;P&gt;When I add this to my html,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;button onclick='toggleInsert1()' id="insertToggleButton"&amp;gt;See Analytics&amp;lt;/button&amp;gt;&lt;/P&gt;&lt;P&gt;I get this after i save it&lt;/P&gt;&lt;P&gt;&amp;lt;button id="insertToggleButton"&amp;gt;See Analytics&amp;lt;/button&amp;gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 19:47:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204354#M7965</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T19:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204355#M7966</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/57778"&gt;@fayettec&lt;/a&gt;&amp;nbsp;- If you're adding it in a wysiwyg, hubspot does some things to sanitize the html and maintain scopes of javascript (mostly seen in embed codes but, could be happening in this scenario as well). It's best to use the following code:&lt;/P&gt;&lt;PRE&gt;&amp;lt;script&amp;gt;
$(function(){
  $('#insertToggleButton').on('click', function(){
    toggleInsert1();
  });
});
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;P&gt;If this answer helped, please, mark as solved &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;tim@belch.io | &lt;A href="https://forms.belch.io" target="_blank"&gt;forms.belch.io&lt;/A&gt; | Design your own Beautiful HubSpot Forms; No coding necessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Drop by and say Hi to me &lt;A href="http://slack.belch.io/" target="_blank"&gt;on slack&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:09:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204355#M7966</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-08-29T20:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204358#M7967</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/57778"&gt;@fayettec&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It does sound like you are trying to put the code in the the source code for a richtext area. I know that the rich text editor has rules for it's markup and will manipulate mark up to match those rules. &amp;lt;a&amp;gt; tags with out the "href" attribute are removed as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use jquery to insert the onlclick on page load like&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;&amp;nbsp;said, you can write an onclick function that targets a unique class on the button:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;button class="the_button"&amp;gt;click&amp;lt;/button&amp;gt;

$('.the_button').on('click touch', function(){

});&lt;/PRE&gt;
&lt;P&gt;or you can find a way to hard code the button, such as by using a custom module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need help? &lt;A href="https://www.upwork.com/o/companies/_~0124e15ff34efb3871/" target="_blank" rel="noopener"&gt;Hire Us Here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 10:02:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204358#M7967</guid>
      <dc:creator>Jsum</dc:creator>
      <dc:date>2019-05-31T10:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204359#M7968</link>
      <description>&lt;P&gt;Thanks, But that didn't work either. Causing an exception.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 19:59:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204359#M7968</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204361#M7969</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/57778"&gt;@fayettec&lt;/a&gt;&amp;nbsp;- It would help to see the full JS error or a preview link to the page causing the issues. The error is probably unrelated to your original issue.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:02:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204361#M7969</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-08-29T20:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204363#M7971</link>
      <description>&lt;P&gt;$(function{ x&amp;nbsp;&amp;nbsp;&lt;BR /&gt;$('#insertToggleButton').on('click', function(){&lt;BR /&gt;toggleInsert1();&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncaught SyntaxError: Unexpected token {&lt;/P&gt;&lt;P&gt;the x is where chrome indicated an error&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:08:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204363#M7971</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T20:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204365#M7973</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/57778"&gt;@fayettec&lt;/a&gt;&amp;nbsp;- My apologies, I forgot a syntax in the code (it was untested). I updated my original answer if you can copy the code again.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:09:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204365#M7973</guid>
      <dc:creator>tjoyce</dc:creator>
      <dc:date>2018-08-29T20:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204370#M7976</link>
      <description>&lt;P&gt;I also found that comments inside my JS caused HubSpot&amp;nbsp;to make the entire function&amp;nbsp;a comment &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:22:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204370#M7976</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T20:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204371#M7977</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2450"&gt;@tjoyce&lt;/a&gt;Thanks for your Help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:24:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204371#M7977</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T20:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Onlcick is stripped from my code</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204373#M7978</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/3688"&gt;@Jsum&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:25:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Onlcick-is-stripped-from-my-code/m-p/204373#M7978</guid>
      <dc:creator>fayettec</dc:creator>
      <dc:date>2018-08-29T20:25:19Z</dc:date>
    </item>
  </channel>
</rss>

