How can we help? 👋

Assigning a widget-popup function to a button or another page element

Learn how to initiate pop-up with a function

Last updated on July 20, 2022

⚠️
This article is for your website support specialist. It will allow you to make a link/button in order to trigger see the Convolo Leads pop-up. It is the one that asks you to fill out the form and promises a callback in X seconds.
 

Easiest way to do that - use API function window.leadCM.open()

  • For buttons:
<button>OPEN</button>
// add an attribute
<button onclick="window.leadCM.open();">OPEN</button>
 
  • For links:
a href = "#"
onclick = "window.leadCM.open();" > OPEN < /a>
//or it's possible to assign to existing element using a snippet with **addEventListener:**

if (document.querySelector("#myButtonId"))
    document.querySelector("#myButtonId")
    .addEventListener("click", function() {
        if (window.leadCM.open) window.leadCM.open();
    });

//to assign popup to links <a href=”#callback” ..> it is possible to use a snippet:

document.querySelectorAll('a[href="#callback"]')
    .forEach(el => el.addEventListener("click", function() {
        if (window.leadCM.open) window.leadCM.open();
    }));
 

If you have any questions, please email us at support@convolo.ai

Did this answer your question?
😞
😐
🤩