• Resolved phoe999

    (@phoe999)


    Hi, I have a problem. I’m using Typeform to create a survey for my website. I managed to write a script that, when I press a button, launches a survey in a window on my website. I connected the WordPress button ID to the script. At some point everything was working, but now suddenly the button instead of running the script redirects to polygonstudio.eu/# (the link in the button settings is empty, so it is set to # by default). Below is the script code that I pasted in WPCode to the Head section as “Universal Fragment”:

    <script src="https://embed.typeform.com/next/embed.js"></script>
    
    <script>
      document.addEventListener("DOMContentLoaded", function() {
        var myButton = document.getElementById("ankietabutton");
        if (myButton) {
          myButton.addEventListener("click", function() {
            window.typeformEmbed.makePopup('https://9ypjmq3pbhg.typeform.com/to/vz0yqohg#utm_source=tf-embed-popup-button', {
              mode: 'popup',
              hideHeaders: true,
              hideFooter: true
            }).open();
          });
        }
      });
    </script>

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @phoe999,

    From what I can see, the Typeform script is no longer making the makePopup method available in the typeformEmbed object. You can check the Browser Console for JavaScript errors when the button is clicked.

    The problem here is strictly related to the script you are trying to add and not specific to WPCode, I suggest checking the Typeform documentation or reaching out to their support.

Viewing 1 replies (of 1 total)
  • The topic ‘Running the script with a button’ is closed to new replies.