Remove the wrapper from a field in a HubSpot custom module

    Difficulty Level: Advanced. This post assumes a strong understanding of HubSpot tools and technical knowledge. Insutructions are given as guidelines and may require additional customisation.

    Sometimes you may wish to remove the wrapper that appears around a field you create in a HubSpot custom module. 

    For example, it you create a Rich Text field called "Description", you can add it to your custom module using this snippet: 

    {% inline_rich_text field="description" value="{{ module.description }}" %}

    like this: 

    Rich text snippet in a custom module

    However, if you inspect the output, you'll see that it's wrapped it using some of HubSpot's markup, highlighted in bold below: 

    <div id="hs_cos_wrapper_module_14800269481_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_rich_text" style="" data-hs-cos-general-type="widget" data-hs-cos-type="inline_rich_text" data-hs-cos-field="description"><p>A short description of your product or service.</p></div>

    If you just want to display the <p> element, you have one of two options: 

    • Copy the value only
    • Set the no_wrapper parameter

    Copy the value only

    Hover over the field, click on Actions and click on "Copy value only".

    Custom module field - copy value only

    This will look something like the following snippet which you can use in your custom module: 

    {{ module.description }}

    Set the no_wrapper parameter

    You can also update your snippet above by adding in the no_wrapper HubL parameter, like this: 

    {% inline_rich_text field="description" value="{{ module.description }}", no_wrapper=True %}
    Last Updated: October 24, 2019

    Thank you! I appreciate the feedback 😊

    Sorry to hear that! 🙁

    I'd appreciate if you could take a moment to let me know how I can improve this article.

    💻

    Looking for a HubSpot website developer?

    I can help you with website themes, templates, page setup and custom modules. 

    Get in touch

    Stephanie O'Gay Garcia

    Hi! 👋 I'm a freelance HubSpot Website Designer & Developer based in Toronto (Canada). Give me a shout if you have questions about this post or there's anything I can help you with.