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.
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:
<input type="email" name="email" placeholder="Email" class="email required valid" id="aim_Email">
<input type="password" name="password" id="aim_Password" placeholder="Password" class="newpassword password required aimError" style="">
$('.required').live('blur', function (value) {
if ($(this).hasClass('valid') && $(this).val()) {
count++;
if (count > 1) {
alert('event fired');
$(".submit").removeClass("disabled");
$(C.options.currentPage).find('input[type="submit"]').removeAttr("disabled");
$('.passwordHint').hide();
}
}
});