升级我的jQuery版本后,出现此问题。经过数小时的工作(有很多jquery文件),我最终发现的是这个问题的提出-因为在控制台中,它指向我的是实际文件,而后者只是指向jQuery文件。
这是我的控制台中显示的内容:
Uncaught Error: Syntax error, unrecognized expression: .menu-item > a[href*=#], .porto-sticky-nav .nav > li > a[href*=#], a[href^=#].hash-scroll, .hash-scroll-wrap a[href^=#]
这是从以下代码触发的:
$('.menu-item > a[href*=#], .porto-sticky-nav .nav > li > a[href*=#], a[href^=#].hash-scroll, .hash-scroll-wrap a[href^=#]').on('click', function(e) {
// My code goes here...
});
有人可以让我知道我在做什么错吗?
给加上引号#
。更改#
为"#"
$('.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"], a[href^="#"].hash-scroll, .hash-scroll-wrap a[href^="#"]').on('click', function(e) {
// My code goes here...
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句