title: Check if string is empty with jquery
body: <p>I am running a client side validation javascript which will submit a form via an ajax post after validating the data. Here is the javascript: </p>
  
  <pre><code>$(".button").click(function() {
  
              $(".error").hide();
  
              var name = $(":input.name").val();
              if ((name == "") || (name.length &lt; 4)){
  
                  $("label#nameErr").show();
                  $(":input.name").focus();
                  return false;
              }
  
              var email = $(":input.email").val();
              if (email == "") {
  
                  $("label#emailErr").show();
                  $(":input.email").focus();
                  return false;
              }
  
  
              var phone = $(":input.phone").val();
              if (phone == "") {
  
                  $("label#phoneErr").show();
                  $(":input.phone").focus();
                  return false;
              }
  
              var comment = $("#comments").val();
              if ((!comment) || (comment &gt; 100)) {
  
                  $("label#commentErr").show();
                  $("#comments").focus();
                  alert("hello");
                  return false;
              }
  
              var info = 'name:' + name + '&amp;email:' + email + '&amp;phone:' + phone + '&amp;comment:' + comment;
              var ajaxurl = '&lt;?php echo admin_url("admin-ajax.php"); ?&gt;';
              alert(info);
  
              jQuery.ajax({
  
                  type:"post",
                  dataType:"json",
                  url: myAjax.ajaxurl,
                  data: {action: 'submit_data', info: info},
                  success: function(response) {
                      if (response.type == "success") {
  
                          alert("success");
                      }
                      else {
  
                          alert("fail");
                      }
                  }
              });
  
              $(":input").val('');
              return false;
  
  
          });
  </code></pre>
  
  <p>The four input fields are three text inputs for name, email and phone and then one textarea for the comments/queries section. The problem is that if I leave the textarea blank  or enter over 100 characters the script does not go into the if ((!comment) || (comment > 100))
  statement. I am wondering if there is a different value that gets assigned to a textarea when it is blank that is stopping the code from seeing it as empty ? </p>