JQuery not defined with WP Rocket Plugin
-
Hi. there is an issu with inline javascript which is caused when the JQuery is deffered. you can fix this by replacing the inline script tag on
include/templates/forms/custom_form.phpwith this one:
<script type=”text/javascript”>
window.addEventListener(“load”,function(event) {
var jQuery = window.jQueryWP || window.jQuery;
var form_container = jQuery(“#mailerlite-form_<?php echo $form_id; ?>[data-temp-id=<?php echo $unique_id; ?>] form”);
form_container.submit(function (e) {
e.preventDefault();
}).validate({
submitHandler: function (form) {jQuery(this.submitButton).prop(‘disabled’, true);
form_container.find(‘.mailerlite-subscribe-button-container’).fadeOut(function () {
form_container.find(‘.mailerlite-form-loader’).fadeIn()
});var data = jQuery(form).serialize();
jQuery.post(‘<?php echo admin_url( ‘admin-ajax.php’ ); ?>’, data, function (response) {
form_container.find(‘.mailerlite-form-inputs’).fadeOut(function () {
form_container.find(‘.mailerlite-form-response’).fadeIn()
});
});
}
});
},false);</script>
- The topic ‘JQuery not defined with WP Rocket Plugin’ is closed to new replies.