Divi button popup HubSpot form

Adding a Button to a Divi Page for HubSpot Form Popup

by | Aug 31, 2023 | 0 comments

In the world of web design, creating an engaging user experience is paramount. One effective way to capture user attention and encourage interaction is by using popups or lightboxes. These elements can display additional content without redirecting the user to a new page. In this tutorial, we’ll walk you through the process of adding a button to a Divi page that opens a popup containing a HubSpot form, utilizing the Divi Builder’s features and some custom code.

Step 1: Set Up HubSpot Form

Before diving into the Divi configuration, you need to create a HubSpot form that you want to display in the popup. Follow these steps:

Log into HubSpot: Access your HubSpot account or create one if you don’t have it.

Navigate to Forms: Go to the “Marketing” tab and select “Lead Capture” > “Forms.”

Create a New Form: Click on the “Create form” button.

Design Your Form: Use HubSpot’s intuitive form builder to design your form. Add fields, labels, and customize the appearance to match your website’s design.

Configure Options: Set up form options like submission actions and notifications.

Save and Get Embed Code: After designing your form, save it and obtain the embed code. You’ll need this code later to place the form in your popup.

Step 2: Create the Divi Button

Log into Your WordPress Dashboard: Access the backend of your WordPress website.

Navigate to Divi Builder: If you’re using Divi, navigate to the page where you want to add the button and open it in the Divi Builder.

Add a New Section: Click the “+” button to add a new section, and choose the one-column structure.

Add Button Module: Click the gray “+” button to add a new module, then search for and select the “Button” module.

Configure Button Settings: In the module settings, input the button text, link URL (you can use “#” for now), and customize the button design to your liking.

Step 3: Set Up the Popup

Install and Activate a Popup Plugin: To create a popup, you might need to use a popup plugin compatible with Divi. Plugins like “Popup Maker” or “Divi Overlays” can work well. Install and activate the plugin of your choice.

Create a New Popup: Use the plugin’s interface to create a new popup. Customize the popup’s appearance, size, and behavior settings.

Add HubSpot Form Code: Inside the popup content, you can usually input custom HTML or shortcode. Paste the HubSpot form embed code obtained earlier into this area.

Configure Popup Trigger: Configure the trigger for the popup. In this case, you want the popup to open when the button is clicked. Copy the CSS class or ID assigned to your button.

Step 4: Add Custom JavaScript (Optional)

If your popup plugin doesn’t offer built-in support for triggering the popup through a button, you might need to add custom JavaScript to make it work. This step can vary based on the popup plugin you’re using. Here’s a general approach:

Access the Theme Customizer: Navigate to “Appearance” > “Customize” in your WordPress dashboard.

Open Additional CSS: If available, open the section for adding additional CSS code.

Add JavaScript Code: Insert JavaScript code that targets the button’s class or ID and triggers the popup to open. This might involve using jQuery or plain JavaScript. For example:

  1. jQuery(document).ready(function($) {

    $(‘.your-button-class’).on(‘click’, function(e) {

    e.preventDefault();

    // Code to trigger the popup

    });

    });

    Remember to replace 'your-button-class' with the actual class or ID of your button element, and adjust the code according to your popup plugin's requirements.

Conclusion

Creating a button on a Divi page that opens a popup containing a HubSpot form is a fantastic way to engage your website visitors without taking them away from the page. By utilizing the Divi Builder’s features and possibly some custom code, you can seamlessly integrate this interactive element into your website and enhance user engagement.

Remember to test thoroughly after implementation to ensure that the button and popup work as expected, and make any necessary adjustments based on your specific website setup and chosen plugins.

Learn more on this topic

Related Blog Posts

Why Use Divi Wireframes to Make Money Faster

Why Use Divi Wireframes to Make Money Faster

In today’s fast-paced digital world, having a professional and functional website is essential for businesses, freelancers, and entrepreneurs. However, designing a website from scratch can be time-consuming, especially if you want it to look polished and engaging....