再会,
我收到以下错误:
Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])
用于库jquery-2.2.3.min.js:2
下面是代码:
$(document).ready(function() {
$('.collapse').on('show.bs.collapse', function() {
var id = $(this).attr('id');
$('a[href="#' + id + '"]').closest('.panel-heading').addClass('active-faq');
$('a[href="#' + id + '"] .panel-title span').html('<i class="glyphicon glyphicon-minus"></i>');
});
$('.collapse').on('hide.bs.collapse', function() {
var id = $(this).attr('id');
$('a[href="#' + id + '"]').closest('.panel-heading').removeClass('active-faq');
$('a[href="#' + id + '"] .panel-title span').html('<i class="glyphicon glyphicon-plus"></i>');
});
});
我正在使用最新的Jquery CDN
<!-- Javascript and Jquery files -->
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
本#
是一个特殊字符,需要转义,如:
'a[href*=\\#]:not([href=\\#])'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句