Code Snippets
Load more
{# HTML #}
{% if module.faq|length > module.show_of_default %}
<div id="{{name}}loadMore" class="text-right">
<a href="#" class="btn btn-outline-primary">View All</a>
</div>
{% endif %}
{# CSS #}
{% if module.faq|length > module.show_of_default %}
.sr-faq-01 .faq-item:nth-child(n+{{ module.show_of_default + 1}}) {
display: none;
}
{% endif %}
{# JS #}
{% if module.faq|length > module.show_of_default %}
$(".{{name}} #{{name}}loadMore").on('click', function (e) {
e.preventDefault();
$(".{{name}} .faq-item").slice(0, 99).show();
$(this).remove();
});
{% endif %}
URL Parameters
{# http://www.example.com?name=John #}
{% if request.query_dict.name%}
{{request.query_dict.name}}
{% endif %}
Sending data to a hidden form field
hbspt.forms.create({
target: '.hs-form-embed', {# Optional, create form in the target #}
portalId: "{{hub_id}}",
formId: "{{ module.step_4.form.form.form_id }}",
{# Send all the data to the hidden field #}
onFormReady: function($form) {
$('input[name="hidden_field"]').val('Hello World').change();
}
});
Check if a contact is in a list
{% set list = [] %}
{% if request_contact.list_memberships is iterable %}
{% for list_id in request_contact.list_memberships %}
{% if list_id == module.step_4.list_ID %}
{% if list.append(1) %} {% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if list|length == 0 %}
{% endif %}
Check if there is a contact
{% if !contact_without_defaults.firstname %}
{% endif %}
Last updated