Adding custom classes on invalid submissions not working
-
Hi,
I have a script on my website that seems to stop working. When testing the wpcf7-not-valid class seems to be added after wpcf7invalid runs.
Here is a copy of the script:
$(function () {
$(document).on('wpcf7invalid', function(event) {
for (let i = 0; i < event.target.elements.length; i++) {
console.log(event.target.elements[i].classList);
// console.log(event.target.elements[i].classList.contains('wpcf7-not-valid'));
if (event.target.elements[i].classList.contains('wpcf7-not-valid') !== false) {
$(event.target.elements[i]).addClass('is-invalid');
}
}
});Thanks.
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.