onSubmit function for multiple typeform on one page

487 views Asked by At

I am embedding 2 typeform on my webpage. When I submit 1st typefrom onSubmit function get executed, but onSubmit function of 2nd typeform get called automatically even I submitted the 1st typeform.

<div id="my-embedded-typeform1" style="width: 100%; height: 300px;"></div>
<div id="my-embedded-typeform2" style="width: 100%; height: 300px;"></div>

<script src="https://embed.typeform.com/embed.js" type="text/javascript"</script>
 window.addEventListener("DOMContentLoaded", function() {
      var el = document.getElementById("my-embedded-typeform1");
      var el2 = document.getElementById("my-embedded-typeform2");
      window.typeformEmbed.makeWidget(el1, "https://admin.typeform.com/to/cVa5IG", {
        hideFooter: true,
        onSubmit: () => { alert('Typeform 1 submitted') }
      });
window.typeformEmbed.makeWidget(el2, "https://admin.typeform.com/to/cVa5IG", {
        hideFooter: true,
        onSubmit: () => { alert('Typeform 2 submitted') }
      });
    });
0

There are 0 answers