HubSpot Form Block

Embed a HubSpot form into a WordPress post using the form’s ID.

Run the following snippet in your JavaScript dev console to show all hidden fields

// Inputs within a HubSpot iframe
var theIframe = document.querySelector(".hs-form-iframe");
if (theIframe) {
    var iframeDoc = theIframe.contentWindow.document;
    var iframeInputs = iframeDoc.querySelectorAll('input[type="hidden"]');
    for (var i = 0; i < iframeInputs.length; i++) {
        iframeInputs[i].type = "text";
    }
    var iframeDivs = iframeDoc.querySelectorAll("div.hs-form-field");
    for (var i = 0; i < iframeDivs.length; i++) {
        iframeDivs[i].style.display = "block";
    }
}

// Inputs directly injected into the page by HubSpot
var theInputs = document.querySelectorAll('form input[type="hidden"]');
for (var i = 0; i < theInputs.length; i++) {
    theInputs[i].type = "text";
}
var theDivs = document.querySelectorAll("form div.hs-form-field");
for (var i = 0; i < theDivs.length; i++) {
    theDivs[i].style.display = "block";
}

Examples

Register for webinar

Label

Where is this block used?

This block is used on 8 different URLs

Source Files

Login to WordPress to see source file details.