title: Jquery each loop not working?
body: <pre><code>$(':submit').click(function(e) {
      $('.requiredField :input').each(function() {
          if ('input[type=text]'){
              if($(this).val().length === 0) {
                  $(this).addClass('warning'); //
                  var errorMsg = $('&lt;br /&gt; Please Fill all the Fields').addClass('warning');
                  errorMsg.insertAfter('.requiredField .textbox');
              }
          }
      });
      e.preventDefault(); //preventing form submission
  });
  </code></pre>
  
  <p>All i need from this function is to give error message on each empty textboxes but it instead does something like:
  if i have two empty textboxes it gives error on all the textboxes x 2? Help please?</p>