title: jquery custom validation script without plugin?
body: <p>i used to use jquery validation plugin but because of lack of this plugin with wysiwyg plugins i wrote a simple script to validate my form</p>
  
  <p>i tried to do it like this</p>
  
  <pre><code>function validateArticle(formData, jqForm, options) { 
    $('#errors').empty();
    if ($('#editor').val() == 0) { 
      $('#errors').show();
      $('#errors').append('&lt;li&gt;please enter your article body&lt;/li&gt;');
      return false; 
    } 
    if ($('#ArticleTitle').val() == 0) { 
      $('#errors').show();
      $('#errors').append('&lt;li&gt;please enter your article title&lt;/li&gt;');
      return false; 
    }
    $('#errors').hide();
    return true ;
  }
  </code></pre>
  
  <p>i found to 1 problem when it validate the form it's validating it field by field so the errors messages doesn't appear at once</p>
  
  <p>i tried to do something like</p>
  
  <pre><code>var errors = [];
  function validateArticle(formData, jqForm, options) { 
    $('#errors').empty();
    if ($('#editor').val() == 0) { 
      errors.push('&lt;li&gt;please enter your article body&lt;/li&gt;');
      var invalid = 1 ;
      return false; 
    } 
    if ($('#ArticleTitle').val() == 0) { 
      errors.push('&lt;li&gt;please enter your article title&lt;/li&gt;');
      var invalid = 1 ;
      return false; 
    }
    if(invalid == 1){
      $.each(errors , function(i, val) { 
        $('#errors').append(errors [i]); 
      });
    }
  
    $('#errors').hide();
    return true ;
  }
  </code></pre>
  
  <p>i tried to push errors as array elements and loop through them in case of invalid is true
  bu this one doesn't work at it all ?</p>
  
  <p>is there any way to make it work ?</p>