My question is about I use JavaScript to send some form data from Webflow to Typeform. When I create a custom-html tag in Google Tagmanager I get this error:
JavaScript Compiler Error Typeform Tag
Error at line 3, character 1: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.
The same error occurs for line 4,5,6, 13, 14, 15.
This is my code:
<script>
$( "#formbutton" ).click(function() {
const naam = $('#Naam-2').val();
const email = $('#Email-2').val();
const postcode = $('#Postcode-2').val();
Cookies.set('naam', naam, { expires: 30 } );
Cookies.set('email', email, { expires: 30 } );
Cookies.set('postcode', postcode, { expires: 30 } );
});
var Webflow = Webflow || [];
Webflow.push(function() {
const naam = Cookies.get("naam");
const email = Cookies.get("email");
const postcode = Cookies.get("postcode");
$('#naam').val(naam);
$('#email').val(email);
$('#postcode').val(postcode);
});
</script>
Please, share your thoughts or any advices, would highly appreciate it! - thanks you in advance.
I convert es6 code to the old version of js vanilla try this tool:
https://es6console.com/