title: Javascript/JQuery - val().length' is null or not an object
body: <p>I have the error <code>val().length</code> is null or not an object"  from code:</p>
  
  <pre><code>function size(sender, args) {
  
      var sizeVariable = $("input[id$='txtHello']");
      if (sizeVariable.val().length == 0)
      {
            args.IsValid = false;
       }
  }
  </code></pre>
  
  <p>The error occurs on the "If" statement. I am trying to check if:</p>
  
  <ol>
  <li>the variable exists</li>
  <li>if there is something in the variable</li>
  </ol>
  
  <p>I think the problem lies with point (1). How do I check if the text field exists (to hopefully resolve the issue)?</p>