Last active
March 8, 2024 22:15
-
-
Save tobeyadr/a9b52d95372dd2f5ac28e09c02a4091c to your computer and use it in GitHub Desktop.
JS to listen for when the details form is submitted in the calendar.
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
<?php | |
add_action( 'enqueue_groundhogg_calendar_scripts', function (){ | |
// language=javascript | |
$script = 'document.addEventListener("submit", function(event) { | |
// Check if the submitted element is a form with the specific class name | |
if (event.target.matches("form.details-form")) { | |
// Do GA stuff | |
} | |
});'; | |
wp_add_inline_script( 'groundhogg-appointments-frontend', $script ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment