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
  • Loading branch information
Nabeel Ahmed committed Apr 19, 2017
1 parent 8e6b340 commit f787646
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 f787646

Please sign in to comment.