it means that $ (i.e. jquery) is needed earlier. try to either “force JS in head” or exclude jquery.js from optimization.
hope this helps,
frank
Thread Starter
Tonguc
(@resttube)
sorry Frank, but after “force JS in head” I have a new problem:
autoptimize_496e0af6a30c10b799916c6ca749b5ec.php:46 Uncaught TypeError: Cannot read property ‘className’ of null
Impossible to say without seeing your website I’m afraid, do you have a URL you can share?
frank
I think this error is also because jQuery is loaded by WordPress in the no conflict mode.
Tonguc, if it’s your own code which is causing the problem, then you can add this in your code:
var $ = jQuery.noConflict();
Thread Starter
Tonguc
(@resttube)
Thank you, superpoincare! Indeed it works with your code:
var $ = jQuery.noConflict();
the Problem was the toggleNavMain, which works with JS.
The Problem is solved, but unfortunately i have to exclude JS from optimization.
🙁
my URL:http://www.doumaindesign.de/
had a look, you’re currently not “forcing JS into head” so the “$ is not a function”-error is back? fyi, alternatively you could also exclude jquery.js from optimization.
Thread Starter
Tonguc
(@resttube)
to be honest, I tried every opportunity if I force JS into head, I have another Error: “Cannot read property ‘className’ of null” AND my toggleNav doesn’t function 🙁
That’s the reason why I exclude JS from optimization generally.
I see you are using Bootstrap.
Your error seems like a noConflict error.
This page has some info:
http://getbootstrap.com/javascript/#js-noconflict
Thread Starter
Tonguc
(@resttube)
Yes, I use Bootstrap Plugin. (too big JS data!) Thank you, superpoincare! I try to use this code! Many Thanx for your support…