title: jquery find a href by title
body: <p>I have the sidemenu something like below. On clicking the href link, I'm showing the corresponding div id by href title.</p>
  
  <pre><code>&lt;ul class="sidenav"&gt;
      &lt;li&gt;&lt;a href="#" title="sample"&gt;Sample&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#" title="test"&gt;Test&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>I also have the next button, on clicking it, I want to highlight the href on which the current div is being shown.
  So I have the id something like below,</p>
  
  <pre><code>var $title = $(".hidefields:visible").attr('id'); //this is the href title and hidefields is the div class 
  $("a[title|= $title]").css("color", "red");..// this doesn't work.
  </code></pre>
  
  <p>How do I find the href by the variable title? I couldn't find the solution on the internet.</p>