The solution is really simple! Just add this code to the Custom JS field on the Style tab of your Click To Call widget’s settings and you’ll be fine ![]()
const listenerBlock = (selector, callback) => {
const initialTargetNode = document.querySelector(selector);
if (initialTargetNode) {
return callback(initialTargetNode);
}
const mutationObserver = new MutationObserver((mutations, observer) => {
mutations.forEach(({ addedNodes }) =>
addedNodes.forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE) {
const targetNode = node.querySelector(selector);
if (targetNode) {
observer.disconnect();
return callback(targetNode);
}
}
})
);
});
mutationObserver.observe(document.body, {
childList: true,
subtree: true,
});
};
listenerBlock(".eapp-click-to-call-button-component", (button) => {
const link = document.querySelector(".eapp-click-to-call-window-phone");
button.addEventListener("click", (e) => {
e.stopPropagation();
link.click();
});
});
Note: Custom JS doesn’t function in the preview mode, so you can check the result right on your website or through the Share Link
Guys, was this solution helpful? Let us know in the comments ![]()