Created
November 23, 2023 09:52
-
-
Save andxbes/83327b1861014e218eabe36be79bfb03 to your computer and use it in GitHub Desktop.
CF-7 block submit button on sending
This file contains hidden or 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
export default function cf_7() { | |
console.info('cf-7'); | |
let cf_7 = document.querySelectorAll('.wpcf7-form'); | |
if (cf_7 && cf_7.length > 0) { | |
cf_7.forEach(function (cf_7_form) { | |
const submit_button = cf_7_form.querySelector('.wpcf7-submit'); | |
if (submit_button) { | |
cf_7_form.addEventListener('submit', function (event) { | |
submit_button.setAttribute('disabled', ''); | |
}); | |
cf_7_form.addEventListener('wpcf7submit', function (event) { | |
submit_button.removeAttribute('disabled'); | |
}); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment