jQuery selector object does not update on the fly
<p>I'm trying to validate a form by checking the required fields with a jQuery selector.</p>

<pre><code>function validate() {
  if ($('input[required][value=""]').length != 0) {
    console.log("required value missing");
  }
  return false; // to prevent firing default action
}
</code></pre>

<p>There are a couple input elements like so, with the value set in PHP (not shown):</p>

<pre><code>&lt;input id="id" name="name" type="text" required\&gt;
</code></pre>

<p>The problem is that this validate function will read the DOM correctly the first time (i.e will correctly recognize all required, empty inputs), but once I fill in/delete values the  function will keep returning the same set as before, not recognizing the newly empty fields 
or the newly filled fields. Once I refresh the page, however, the selector will correctly grab the right inputs.</p>

<p>I saw the .live() function, but that applies to events.</p>

<p>Does the $(selector) cache (only checks the DOM once instantiated) or is there some other arcane/simple rule for jQuery selectors I'm not paying attention to?</p>
