It will be great to have the option to add more than one email
Hi there, @user3916
Thanks for adding the idea to the Wishlist!
We agree that it would be cool to have this option in the settings. If more users upvote this request, we’ll try to think it over
As for now, you can add the 2nd email using this code in the Custom JS section on the Style tab of your widget’s settings:
const SECOND_EMAIL = "test@test.com";
const EMAIL_SELECTOR = "[class*='content__Block-sc']:nth-child(4)";
const waitForElement = (selector, root = document) => new Promise(res => {
let i = 0;
const check = () => {
const component = root.querySelector(selector);
if (component) {
res(component);
} else if (i !== 150) {
setTimeout(check, 100);
i++;
}
};
check();
});
waitForElement(EMAIL_SELECTOR).then((emailBlock) => {
const emailBlockCopy = emailBlock.cloneNode(true);
const anchor = emailBlockCopy.querySelector("a");
anchor.href = `mailto:${SECOND_EMAIL}`;
anchor.textContent = SECOND_EMAIL;
emailBlock.insertAdjacentElement("afterend", emailBlockCopy);
});
In the 1st line of the code, you should add the needed email
Note: Custom JS operates only upon widget installation, not in preview mode. Thus, the 2nd email will be displayed only on the page with the widget, but not in the editor.
1 Like
perfect! everything works great, thank you!
1 Like
@user3916 Awesome, you are always welcome