Jquery bug and JS errors

Hi
I don’t understand why I have this on my website as jquery is obviously present.

Thanks for the support

Hi @angristan,

Sorry to hear of the problem you are having.

I have tested it on my test site using latest version of Sparkling theme but i didn’t get any such error.

Could you please share me your site URL where it’s displaying so that i can troubleshoot it?

This can be due to plugin conflict on your site so please try temporary deactivating all plugins and see whether everything works fine and then enable the plugins one by one to see which plugin is conflicting if any.

Kind Regards,
Movin

My website is https://angristan.fr/

I tried to desasctivate all plugins but no changes. I also tried to desactivate PageSpeed.

Thanks for your support (and happy new year) :slight_smile:

Hi @angristan,

I could confirm the issue on your shared site which seems causing by not loading js files in the proper order.

This can be child theme issue on your site so to confirm it just temporary use the Sparkling theme instead of child theme on your site. If everything works fine then it’s your child theme issue so just share me your child theme so that i can troubleshoot it.

If it’s not the child theme issue then just try temporary using default Twenty Sixteen theme to confirm whether it’s Sparkling theme issue. if the issue persists with default theme then it’s your CDN issue that you are using on your site.

Regards,
Movin

I am so sorry… It was my fault.

I had this in my child theme for a long time :

// Async JS
add_filter( 'script_loader_tag', 'add_async', 10, 2 );
function add_async( $tag, $handle ) {
    return str_replace( ' src', ' async src', $tag );
}

This to make the JS asynchronous but apparently it breaks it. If you know any alternative I’ll be glad to hear it.

Sorry again, thank you for wonderful support.

Hi @angristan,

Awesome great to see you got that figured out.

Instead of Async attribute you can try using Defer attribute as described on the following pages.

http://orbitingweb.com/blog/add-defer-async-attributes-to-scripts-in-wordpress/

Regards,
Movin

Hi Movin, I am now using this plugin : Autoptimize – WordPress plugin | WordPress.org it combines and defers JS, it’s perfect.

Thanks again :smiley:

You are most welcome here :slight_smile: