title: How to validate empty fields without plugin
body: <p>I have the fellowing code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function validateEmail(email) { 
  var re = /^(([^&lt;&gt;()[\]\\.,;:\s@\"]+(\.[^&lt;&gt;()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  return re.test(email);
  }
  $(document).ready(function() {
  $("#enviar").click(function() {
  
  
  
  var nome = $.trim($("input#nome").val());
  if (nome == "") {
  $("#nome").focus();
  $("#nome").css("background-color","#802c2c");
  return false;
  }
  var email = $.trim($("input#email").val());
  if (email == "") {
  $("#email").focus();
  $("#email").css("background-color","#802c2c");
  return false;
  }
  if (!validateEmail(email)) {
  $("#email").focus();
  $("#email").css("background-color","#802c2c");
  return false;
  }
  var telefone = $.trim($("#telefone").val());
  if (telefone == "") {
  $("#telefone").focus();
  $("#telefone").css("background-color","#802c2c");
  return false;
  }
  var mensagem = $.trim($("#mensagem").val());
  if (mensagem == "") {
  $("#mensagem").focus();
  $("#mensagem").css("background-color","#802c2c");
  return false;
  }
  });
  
  $('input').keypress(function() { $(this).css("background-color","#17120d") });
  $('textarea').keypress(function() { $(this).css("background-color","#17120d") });
  
  });
  $(function () {
  "use strict";
  $('form').on('submit', function (e) {
   e.preventDefault();
  $('#unload').fadeOut(2000);
  $('#loading').delay(2000).fadeIn(900);
  $("#loadresult").hide().delay(2000).fadeIn(900);
  
      $.ajax({
              type: 'post',
              url: 'mailer/sendmail.php',
              data: $('#inner-contact').serialize(),
              success: function (html) {
              $("#loadresult").fadeOut(1000);;
              $("#postresult").delay(1000).fadeIn(2000);
              $("#another").hide(1009).delay(2000).fadeIn(2200);
              }
            });
  
  });
  
     $('#another').click(function() {
  
      $("#another").hide(100).fadeOut(2000);
      $('#loading').fadeOut(2000);
      $("#postresult").fadeOut(2000);
      $("#unload").delay(2400).show(200); 
     });
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>But with this code i can only validate one field at a time. How can I check all fields at once? As the code is, it validates field by field, that is, when I click on the "send" button it checks the first field, then the second, then the third, and so on. But I need it to check all the fields at once, applying the background color to all those fields that are empty.</p>