Skip to content

Instantly share code, notes, and snippets.

@coulterpeterson
Created May 4, 2023 18:54
Show Gist options
  • Save coulterpeterson/5f88737c556e699f4bae995b5f5814e2 to your computer and use it in GitHub Desktop.
Save coulterpeterson/5f88737c556e699f4bae995b5f5814e2 to your computer and use it in GitHub Desktop.
Conditionally Hide A Gravity Forms Post Content Merge Tag Based On Its Value
<div id="timekeeping-solution">{Are you interested in a timekeeping solution that would allow employees to easily clock in and out online?:22}</div>
<script>
// When the page is ready
window.addEventListener('load', function () {
if (document.querySelector('body') !== null) { // Some element that should be rendered by now before we execute code
const timekeepingSolution = document.querySelector('#timekeeping-solution');
if( timekeepingSolution.innerHTML == "No" ) {
timekeepingSolution.style.display = "none";
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment