You're very close! The line you provided:
document.querySelector('#pricing-table-content').style.maxWidth = '80%';
needs to be placed inside a function that is executed when the script runs and the DOM is ready.
Based on your current code structure, the activate function is the main entry point after pollerLite confirms the necessary elements are present.
You can place it right after setup() and the setTimeout call within the activate function. This ensures the element is available and the style is applied early in your script's execution.
Here's where to put it:
const activate = () => {
if (window[`${ID}__result`]) {
window[`${ID}__result`] = {};
}
setTimeout(() => {
MktoForms2.whenReady(function(form) {
form.getFormElem()[0].reset(); // Clears all fields
});
}, 2000);
setup();
// Place your line here:
document.querySelector('#pricing-table-content').style.maxWidth = '80%';
init(); // This function will then render the multi-step form within the adjusted container
// ... rest of your activate function
document.body.addEventListener("click", (e) => {
// ...
});
monitorOptionSelection(ID);
};
This ensures document.querySelector('#pricing-table-content') definitely exists by the time this line is executed, as pollerLite waits for #pricing-table-content h4 (which implies #pricing-table-content exists) before calling activate.