var userFullName = 'FirstName LastName'; var userEmail = 'user@sample.com'; // Define the closeForm event handler function closeForm({ formId }) { $('#step-two').fadeOut(); $('#step-three').delay(500).fadeIn(); } // Replaces special characters var decodeEntities = (function() { // this prevents any overhead from creating the object each time var element = document.createElement('div'); function decodeHTMLEntities (str) { if(str && typeof str === 'string') { // strip script/html tags str = str.replace(/]*>([\S\s]*?)<\/script>/gmi, ''); str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, ''); element.innerHTML = str; str = element.textContent; element.textContent = ''; } return str; } return decodeHTMLEntities; })(); $(document).ready(function () { cert_title = decodeEntities(cert_title); webinarName = decodeEntities(webinarName); cert_facil = decodeEntities(cert_facil); $("#load-typeform").click(function () { var typeformFormat; if (typeformLink.includes('#') == true) { typeformFormat = typeformLink.split('#'); typeformFormat = typeformFormat[0].split('/'); } else { typeformFormat = typeformLink.split('/'); } var typeformID = typeformFormat[typeformFormat.length - 1] userFirstName = $('#user-first-name').val(); userLastName = $('#user-last-name').val(); userFullName = userFirstName + ' ' + userLastName; userEmail = $('#user-email').val(); if (userEmail == '' || userFirstName == '' || userLastName == '') { $('#error').show(); return } $('#error').hide(); $('#step-one').fadeOut(); var typeformEmbed = `