mdb-ui-kit icon indicating copy to clipboard operation
mdb-ui-kit copied to clipboard

Uncaught Error: Syntax error, unrecognized expression: # When I use dropdown menu with jquery-3.1.1

Open ghost opened this issue 9 years ago • 10 comments

Test Case

when I user copy dropdown menu from http://fezvrasta.github.io/bootstrap-material-design/#navbar, I got the problem: jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: # at Function.ga.error (jquery.min.js:2) at ga.tokenize (jquery.min.js:2) at ga.select (jquery.min.js:2) at Function.ga [as find] (jquery.min.js:2) at r.fn.init.find (jquery.min.js:2) at r.fn.init (jquery.min.js:2) at r (jquery.min.js:2) at b (bootstrap.min.js:6) at HTMLAnchorElement.g.toggle (bootstrap.min.js:6) at HTMLDocument.dispatch (jquery.min.js:3)

Summary

with jQuery v3.1.1

ghost avatar Dec 28 '16 02:12 ghost

my dropdown menu code: <li class="dropdown"> <a href="#" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="javascript:void(0)">Action</a></li> <li><a href="javascript:void(0)">Another action</a></li> <li><a href="javascript:void(0)">Something else here</a></li> <li class="divider"></li> <li class="dropdown-header">Dropdown header</li> <li><a href="javascript:void(0)">Separated link</a></li> <li><a href="javascript:void(0)">One more separated link</a></li> </ul> </li>

ghost avatar Dec 28 '16 02:12 ghost

Thank you for your issue.

Unfortunately I can't answer to all the reported issues without a little help from you. Please, make sure to follow the issues template when you submit a new issue, in this way I will already have all the informations needed to understand the problem and help you with it.

I'm closing this issue for now, but feel free to open a new one making sure to follow all the instructions!

Thank you for your understanding.

FezVrasta avatar Dec 28 '16 16:12 FezVrasta

@lbfreeze I've noticed the same issue. It may be caused by using higher version of jQuery. In my case (I was using laravel and it use jquery 3.1 as default option), I switch to jQuery 1.12.4 and it works soon.

Hope it'll help you :)

liyi-david avatar Jan 10 '17 07:01 liyi-david

@liyi-david it worked so well. Thanks!

FranciscoSalesCarvalho avatar Apr 10 '17 20:04 FranciscoSalesCarvalho

@FezVrasta Are there any plans to fix this without having to downgrade jquery?

trickly avatar Aug 10 '17 16:08 trickly

PRs to fix the incompatibility are more than welcome!

FezVrasta avatar Aug 10 '17 17:08 FezVrasta

@liyi-david это не решение проблемы. Что вы будете делать когда необходимо будет тот же слайдер со свайпами подключить. Вообще в целом дурной совет, извините

janhelly avatar Aug 24 '17 13:08 janhelly

SOLVED

OPEN bootstrap.min.js

FIND n || (n = t.attr("href"), n = n && /#/.test(n) && n.replace(/.*(?=#[^\s]*$)/, "")), r = n && e(n);

AND REPLACE n || (n = t.attr("href"), n = n && /#/.test(n) && n.replace(/.*(?=[^\s]*$)/, "")), r = n && e(n);

bpgusar1 avatar Dec 18 '17 08:12 bpgusar1

yeah... great fix

FezVrasta avatar Dec 18 '17 08:12 FezVrasta

i think you need your jquery.min.js is top of scripts and than bootstrap.min.js or bootstrap.js that will be work any jquery version is work. So hope this work

MaungC avatar Jun 07 '18 07:06 MaungC