Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RobertCalise/eceb977d826c1167cebc5f5adc359188 to your computer and use it in GitHub Desktop.
Save RobertCalise/eceb977d826c1167cebc5f5adc359188 to your computer and use it in GitHub Desktop.
Inject a required "I agree to the Terms" checkbox into an Infusionsoft web form
<script type="text/javascript">
var terms_name = 'Terms &amp; Conditions',
terms_link = 'https://yourwebsite.com/link/to/terms';
jQuery(document).ready(function() {
jQuery('.infusion-submit').before('<div style="margin-bottom: 5px;"><input id="inf_option_IagreetotheTermsConditions" name="inf_option_IagreetotheTermsConditions" style="margin-right:3px;" type="checkbox" value="232" /><label for="inf_option_IagreetotheTermsConditions">I agree to the <a href="'+terms_link+'" target="_blank">'+terms_name+'</a></label></div>');
jQuery('.infusion-form').on('submit', function(e) {
if(!jQuery('#inf_option_IagreetotheTermsConditions').is(':checked')) {
e.preventDefault();
alert('You must agree to the ' + terms_name + ' before submitting this form!');
return false;
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment