title: How can I use jquery to check if two attributes have the same value?
body: <p>I'm trying to write a jquery selector that will select objects that have the same value for two of their attributes.</p>
  
  <p>Something like this:</p>
  
  <pre><code>$('div[attr1=attr2]')
  </code></pre>
  
  <p>Given:</p>
  
  <pre><code>&lt;div attr1="foo" attr2="bar"&gt;A&lt;/div&gt;
  &lt;div attr1="bar" attr2="bar"&gt;B&lt;/div&gt;
  &lt;div attr1="foo" attr2="bar"&gt;C&lt;/div&gt;
  &lt;div attr1="foo" attr2="foo"&gt;D&lt;/div&gt;
  </code></pre>
  
  <p>I want it to return links to the B and D divs.</p>
  
  <p>Any thoughts?</p>