input field validation using jquery
<p>I'm adding a class "valid" to an input field if it matches the email and password criteria. I want to enable a submit button if both the fields have a valid class once the class valid is added it stays there even if the entered input is erased completely. </p>

<p>To fix this I have to either remove the valid class or increment the counter when the field is not empty. I'm trying the second case where I'm checking if the class valid is present and also if the field is not empty. I'm not getting the desired effect with the code below:</p>

<pre><code>&lt;input type="email" name="email" placeholder="Email" class="email required valid" id="aim_Email"&gt;
&lt;input type="password" name="password" id="aim_Password" placeholder="Password" class="newpassword password required aimError" style=""&gt;


$('.required').live('blur', function (value) {
  if ($(this).hasClass('valid') &amp;&amp; $(this).val()) {
    count++;
    if (count &gt; 1) {
      alert('event fired');
      $(".submit").removeClass("disabled");
      $(C.options.currentPage).find('input[type="submit"]').removeAttr("disabled");
      $('.passwordHint').hide();
    }
  }
});
</code></pre>
