- changed status to closed
Jquery throws Syntax error on click
Hi, I have just installed the new Adaptable Theme for Moodle. The functionality seems to work fine but on each click i receive a Jquery error:
#!
Uncaught Error: Syntax error, unrecognized expression: #
at Function.ga.error (jquery-3.1.0.min.js:1)
at ga.tokenize (jquery-3.1.0.min.js:1)
at ga.select (jquery-3.1.0.min.js:1)
at Function.ga [as find] (jquery-3.1.0.min.js:1)
at r.fn.init.find (jquery-3.1.0.min.js:1)
at r.fn.init (jquery-3.1.0.min.js:1)
at r (jquery-3.1.0.min.js:1)
at c (first.js:174)
at HTMLAnchorElement.<anonymous> (first.js:174)
at Function.each (jquery-3.1.0.min.js:1)
As far as I have noticed the error does not have any influence on the functionality but i am not 100% sure. I think the error is caused by functions that have changed between Jquery versions and are outdated in the included Jquery Version or no longer available.
Can somebody give feedback about this error? Do other people have this problem as well? Is there already a bugfix for this?
Comments (8)
-
-
I got this problem after installing moodle 3.2.1 and Adaptable 1.3.1.1.
Didn't change anything else.
Whats BS 2.3? I was able to figure out that this error happened due to deprecated functions in jQuery (load, unload, error)
-
This problem caused the top-right User Menu not to open when clicked in mobile view.
I "fixed" this by using jQuery 1.12 and renaming it.
jquery-1.12.1.js -> jquery-3.1.0.js jquery-1.12.1.min.js -> jquery-3.1.0.min.js
Imho this is a very bad solution, but it is a solution
-
Issue
#646was marked as a duplicate of this issue. -
I've tested, this error will appear if using jQuery 3+. For any <a> element with href="#" used for bootstrap drop down list, it will trigger this error. Then the user menu drop down list will not work on mobile devices with this error.
To solve this issue, I'll suggest change <a> to <div> or <button> if href="#". Or change href="#" to href="javascript:void(0);" for all drop down lists
-
The dropdown issue in mobile view is already fixed and not related with the syntax error.
It is related with your suggest. We made a change to all the href="#" from quote to double quote because seems this was the problem (jQuery 3 needs to escape the URL and this is done with double quote)
But still persist the error. If you have an idea of how to fix the error without downgrade jQuery then you can create a PR and will be glad to add it.
-
- changed status to resolved
Do not use # in target URL for top menu and Navbar tools menu to avoid current jquery and bootstrap incompatibility of version used. Also partly fixes
#617.→ <<cset 56e30272b722>>
-
Great!! I had the same problem. Now it's solved. I use href="javascript:;" instead of href="#" under "Custom menu items" in theme settings.
- Log in to comment
This was an old issue related to BS 2.3 and jQuery and can't be replicated actually.
In any case, the issue has no impact in the theme.