Running the script with a button

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer