Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wurwal/7b5d649062a68921f86c4c56a021bf66 to your computer and use it in GitHub Desktop.
Save wurwal/7b5d649062a68921f86c4c56a021bf66 to your computer and use it in GitHub Desktop.
<script>
jQuery(document).ready(function() {
// When the document is ready
// Bind a click event to the submit button
jQuery('#insert-submit-button').click(function(event) {
// Prevent the default form submission
//event.preventDefault();
// Check if the email field has a value
var emailValue = jQuery('#insert-input-field').val();
// Create a new Date object for 24 hours from now
var expires = new Date();
expires.setTime(expires.getTime() + (24 * 60 * 60 * 1000)); // 24 hours in milliseconds
// Set the cookie variable with the email value and expiration date
document.cookie = "ec_email_cf=" + emailValue + ";expires=" + expires.toUTCString() + ";path=/";
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment