title: jQuery unrecognized expression with hashbang
body: <p>I have some fragments that load on click. I also scroll the page to the top on these links, as found on <a href="https://css-tricks.com/snippets/jquery/smooth-scrolling/" rel="nofollow noreferrer">css-tricks</a>. I get the following error: Uncaught Error: Syntax error, unrecognized expression: #!Fragment_Name</p>
  
  <p>My js</p>
  
  <pre><code>$(function() {
      $('a[href*=#]:not([href=#])').click(function() {
          if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &amp;&amp; location.hostname == this.hostname) {
          var target = $(this.hash);//this is where the error is
          target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
          if (target.length) {
              $('html,body').animate({
              scrollTop: target.offset().top
          }, 1000);
          return false;
          }
      }
      });
  });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;li&gt;&lt;a href="#!Fragment_Name"&gt;Link Text&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>I have tried var target = $($(this.hash)); no joy</p>
  
  <p>Everything still works, I just want to know how to fix this and remove the error from console.</p>