CTA Pop-up code in Rich Text Editor

I am trying to add the code for a CTA pop-up button to the source code of a rich text editor (custom theme module) and when I save the source code, it keeps stripping out the href that contains the javascript.

Code-

<a class="hs-button " href="javascript&colon;postMessage({type:'HS_DISPLAY_CALL_TO_ACTION',id:221074095804});" id="hs-button_widget_1751038264128" rel="">
 Watch Replay
</a>

I got the code by adding a standard button module to the page then viewing the page source. Does anyone know of a way that I can add this without it be stripped out? I was trying to avoid a custom module for the functionality. Using the standard button module is not an option due to the custom theme and the system doesn’t allow you to insert a pop-up cta via the text editor.

Thanks,

Terry

Hi @tmcmillan99,

HubSpot automatically strips out JavaScript in href attributes for security reasons.

Just to confirm, why are you avoiding a custom module?

Assuming the button does not need to be inline (relative) to the content, you can place the “CTA” custom module between two rich text modules.

@GiantFocal Thanks for the reply. The easiest solution was adding a simple link to the CTA popup under the paragraph text. However, based on your answer, that is obviosly not going to be feasible.

This section uses a multi-column content module in a custom theme so adding individual Hubspot modules like buttons is not really an option. As is, I either need to be able to insert it through the rich text editor or add it via the editor source code. The module works great 99.9% of the time. This is the first instance where we needed link out to a CTA pop-up. As a result, I will clone the module then create the option to add in the CTA pop-up buttons. It just adds time to the project and we all know that time is money. :grinning_face:

Thanks,

Terry

Hi @tmcmillan99,

Thank you for the additional context.

Since you are updating the module, I would recommend building the columns and rows using a repeater field with options to add rich text and CTA. This way, you can add more column/row options in the future.