Last active
March 25, 2022 13:16
-
-
Save macariojames/19fdb5c169a4aa38549944f671aba871 to your computer and use it in GitHub Desktop.
MailChimp hide form on successful submit and thank you message; jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a surrounding <div> for all the ish don't want to keep once submission is successful | |
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script> | |
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[1]='FNAME';ftypes[1]='text';fnames[0]='EMAIL';ftypes[0]='email';}(jQuery)); | |
//var $mcj = jQuery.noConflict(true); | |
</script> | |
<script> | |
$(function(){ | |
//$("#mcm_hide_on_submit").hide(); | |
$(".button").on("click", function(){ | |
if ( $('#mce-success-response:visible') ) { | |
console.log('Successfully signed up'); | |
$('#mc_hide_on_submit').hide(); | |
$('#mce-success-response').css('margin', "0"); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vanilla version - slightly different but you get the idea