I have this jQuery Validation function issue. Validation only works once
<p>The function below works as it should. It's to validate a form. In short, I have a couple input fields. If I hit submit and no text has been entered in either input, the validation errors appear. If I fill in one field, only one of the fields will update. But if I hit "submit" again, even without filling in the second form input, the else{} gets fired, not the if{} that should assure it's filled out, etc.</p>

<p>Not familiar, but is it a return false; issue?</p>

<pre><code>if ($('input[type="text"]:visible').val().length == 0) {
    $('.submitModal').click(function () {
        $('.modal').modal('show'); 
    });
}
else {
    $('.submitModal').click(function () {
        $('.modal').modal('hide'); 
    });
}
</code></pre>

<p>Any idea what Im doing wrong?</p>
