title: Creating a new attribute with jQuery
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6303775/jquery-attr-retrieving-custom-attribute-returns-undefined">jQuery .attr retrieving custom attribute returns undefined</a>  </p>
  </blockquote>
  
  
  
  <p>I've got a weird problem, but I'm hoping I'm just doing something stupid.  I'm trying to create a new attribute on an <code>&lt;img&gt;</code> element using jQuery, and this line:</p>
  
  <pre><code>$(selector).attr('selected', 'no');
  </code></pre>
  
  <p>When I inspect the DOM in Chrome, I just see selected="selected", no matter what I set the value to.</p>
  
  <p>Just some extra info:  I can't use just boolean values, as I need to keep track of "Yes", "No" and "Partial" property values.  I'm calling a JS function from the "onClick" event of the img itself, and passing <code>this</code> as a parameter.  I've inspected the object in the method, and the right object is passed; the fact that the attribute is set (even if to the wrong value) also supports this.</p>
  
  <p>I'm dead certain I'm doing something stupid here...  Any advice would be appreciated.</p>