# How to use the Button trigger code snippet as a 'external url'

**URL:** <https://community.hubspot.com/t/how-to-use-the-button-trigger-code-snippet-as-a-external-url/69658>\
**Category:** Lead Capture Tools\
**Tags:** ctas\
**Created:** [November 21, 2022, 1:17pm UTC](https://community.hubspot.com/t/how-to-use-the-button-trigger-code-snippet-as-a-external-url/69658 "2022-11-21T13:17:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [November 22, 2022, 12:49pm UTC](https://community.hubspot.com/t/how-to-use-the-button-trigger-code-snippet-as-a-external-url/69658/4 "2022-11-22T12:49:13Z")

</div>

Hi @Jelmert,

personally I always create a custom module with a modal-box or similar since this gives you near endless possibilities of functionality.  
So basically you can grab one of the free available code-snippets(i.e [bootstrap modals](https://getbootstrap.com/docs/5.2/components/modal/)) from the web and modify it for HubSpot.

It could look something like this:

```lia-code-sample
{# Button trigger modal #}
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modal-{{name|md5}}">
{{ module.button_label }}
</button>

{# Modal box #}
<div class="modal fade" id="modal-{{name|md5}}" tabindex="-1" aria-labelledby="{{ module.modal_label}}" aria-hidden="true">
 <div class="modal-dialog">
 <div class="modal-content">
 <div class="modal-body">
 {% form
form_to_use="{{ module.form.form_id }}"
response_response_type="{{ module.form.response_type }}"
response_message="{{ module.form.message }}"
response_redirect_id="{{ module.form.redirect_id }}"
response_redirect_url="{{module.form.redirect_url}}"
gotowebinar_webinar_key="{{ module.form.gotowebinar_webinar_key }}"
%}
 </div>
 </div>
 </div>
</div>

```

If you want to use a default button you’d have to use the “external URL” option and set it to an ID like “#modal-box”, add a javascript/jQuery which will trigger the modal box opening when a button with this URL is clicked…

Basically the same result as a custom module.

best,

Anton

---

_[View the full topic](https://community.hubspot.com/t/how-to-use-the-button-trigger-code-snippet-as-a-external-url/69658)._
