title: jQuery set then read readonly attr on textbox
body: <pre><code>​&lt;input id="test" type="text" value="text" /&gt;​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
  
  alert(​$(':input:not([readonly])').length);​​​​​​​​​​​​​​​​​ // 1
  
  $('#test').attr('readonly', 'readonly');
  
  alert($(':input:not([readonly])').length); // 1
  
  $('#test').removeAttr('readonly');​​​​​​​​​​
  
  alert($(':input:not([readonly])').length); // 1
  </code></pre>
  
  <p>Further to <a href="https://stackoverflow.com/questions/3708764/jquery-not-readonly-selector">the question here</a>, I can't get the solution to work because it seems jQuery doesn't set the readonly attribute correctly (or at least consistently).</p>
  
  <p>Note I get the same results with <code>$('#test').attr('readonly', true);</code></p>
  
  <p>I'm using Chrome, and the readonly attribute renders as <code>readonly=""</code>. There is another post on here which suggests FireFox does the same.</p>
  
  <p>I'm not much bothered about this in as much as it still stops the text box from being editable, but I can't then find a way to detect the readonly attribute.</p>
  
  <p>I normally love jQuery but this is all a bit WTF.</p>
  
  <p>Any ideas?</p>