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").contentWindow.document;
var theInputs = theIframe.querySelectorAll('input[type="hidden"]');
for (var i = 0; i < theInputs.length; i++) {
    theInputs[i].type = "text";
}
var theDivs = theIframe.querySelectorAll("div.hs-form-field");
for (var i = 0; i < theDivs.length; i++) {
    theDivs[i].style.display = "block";
}

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

Examples

Where is this block used?

This block is used on 7 different URLs

Source Files

Login to WordPress to see source file details.