title: Is it possible to use the required property in IE?
body: <p>I have code like this:</p>
  
  <pre><code>&lt;input required&gt;
  </code></pre>
  
  <p>In good browsers I can use jquery like this to add a class of error to the input:</p>
  
  <pre><code>$('input[required]').addClass('error');
  </code></pre>
  
  <p>It doesn't work in IE though. I will resort to this otherwise, but it's not as neat...</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input data-required=true&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>if( $('input').data('required') ) $('input').addClass('error');
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks,<br>Will</p>
  
  <p>EDIT:</p>
  
  <p>Yea, I am using HTML5.</p>
  
  <p>IE actually interprets this:</p>
  
  <pre><code>&lt;input required&gt;
  </code></pre>
  
  <p>as:</p>
  
  <pre><code>&lt;input required=""&gt;
  </code></pre>
  
  <p>So it is possible to check that like this:</p>
  
  <pre><code>if( $('input').prop() == undefined )
  </code></pre>
  
  <p>But again, it's a bit of a messy way of doing things, especially considering that it is only IE that has the issue. This code works perfectly in all other browsers.</p>
  
  <p>I am basically asking if there is a method of checking that is cross browser and tidy. I'm a bit of a perfectionist perhaps! ;)</p>