title: jQuery attribute selectors - why the quote marks?
body: <p>In jQuery, when selecting by attribute value, why do we need to enclose the value in quotes <code>'</code> <code>'</code>?   </p>
  
  <pre><code>  $("#demo-dropdown a").click(function() {
      var href = $(this).attr("href");
      console.log(typeof (href));  // there shows `string`
      $("#tab-list li a[href= '" + href + "']" ).tab("show");  // why the single-quotes?
  
    });
  </code></pre>
  
  <p>If I use:</p>
  
  <pre><code>$("#tab-list li a[href=" + href + "]" ).tab("show");
  </code></pre>
  
  <p>then I will get a <code>Syntax Error</code>:</p>
  
  <pre><code>Uncaught Error: Syntax error, unrecognized expression: #tab-list li a[href= #profile]
      at Function.fa.error (jquery.min.js:2)
      at fa.tokenize (jquery.min.js:2)
      at fa.select (jquery.min.js:2)
      at Function.fa [as find] (jquery.min.js:2)
      at n.fn.init.find (jquery.min.js:2)
      at new n.fn.init (jquery.min.js:2)
      at n (jquery.min.js:2)
      at HTMLAnchorElement.&lt;anonymous&gt; (index.html?_ijt=o70cto8b6ocd3tq2oh8bck1k4e:171)
      at HTMLAnchorElement.dispatch (jquery.min.js:3)
      at HTMLAnchorElement.r.handle (jquery.min.js:3)
  </code></pre>