ContactForm7 and sweetallert2 does not work after update
-
hello community
recently updated ContactForm7 and found that sweetalert2 does not work any more
script is connected as followsadd_action( 'wp_footer', 'swal_contact', 999 ); function swal_contact() { $title_success = get_option('swal_cf7_title_success'); $duration_success = get_option('swal_cf7_duration_success'); $title_error = get_option('swal_cf7_title_error'); $duration_error = get_option('swal_cf7_duration_error'); ?> <script> jQuery(function($) { $('form.wpcf7-form input, form.wpcf7-form textarea').on("input", function(e) { $(this).removeClass("input-error"); }) $(".wpcf7-submit").click(function(event) { var form = $(this).closest("form"); $(".input-error").removeClass("input-error"); $(document).ajaxComplete(function() { var validMessage = function(){ Swal.fire({ icon: 'success', title: 'Done!', html: 'Thank you for your message.<br>We will contact you shortly.', showCancelButton: false, }); }; var errorMessage = function(){ Swal.fire({ icon: 'warning', title: 'Error', html: 'One or more fields have an error.<br>Please check and try again.', showCancelButton: false, showClass: { popup: 'animate__animated animate__fadeInDown' } }); }; setSwal = $("form.wpcf7-form").hasClass("invalid") ? "alert" : "success"; if ( setSwal === "alert" ) { errorMessage(); $(form).find("[aria-invalid='true']").addClass("input-error"); }; if ( setSwal === "success" ) { validMessage() }; }); }); }); </script> <?php }
[ redundant link removed ]
what am i doing wrong?
last version where everything worked was 5.3- This topic was modified 3 years, 3 months ago by .
- This topic was modified 3 years, 3 months ago by .
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘ContactForm7 and sweetallert2 does not work after update’ is closed to new replies.