Skip to content

Commit

Permalink
Escaping '#' in jQuery selection for click event
Browse files Browse the repository at this point in the history
a[href*=#]:not([href=#]) is incorrect and throws error. # is a special character and must be escaped.
For more info: jquery/jquery#2885

(cherry picked from commit f787646)
  • Loading branch information
Nabeel Ahmed authored and gizmecano committed Feb 11, 2020
1 parent 172ce1e commit f2193b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/partials/javascripts.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
var height = $('.article-image').height();
$('.post-content').css('padding-top', height + 'px');
$('a[href*=#]:not([href=#])').click(function() {
$('a[href*=\\#]:not([href=\\#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var target = $(this.hash);
Expand Down

0 comments on commit f2193b0

Please sign in to comment.