title: Function Expected JavaScript Error
body: <p>Using MVC.. when user hit's Create button and a specific field is null or white space, then display dialog box to confirm.  If field has value, do not display dialog box and go straight to HttpPost Controller Method..</p>
  
  <p>Here is what I have so far:</p>
  
  <p><strong>CSHTML:</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.ATime, "ATime:", htmlAttributes: new { @class = "control-label col-md-2" })
      &lt;div class="col-md-10"&gt;
          @Html.EditorFor(model =&gt; model.ATime, new { htmlAttributes = new { id = "AValue", @class = "form-control a-textbox", @placeholder = "xxxx.x" } })
          @Html.ValidationMessageFor(model =&gt; model.ATime, "", new { @class = "text-danger" })
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="dialog" title="Basic dialog"&gt;
      &lt;p&gt;This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.
      &lt;/p&gt;
  &lt;/div&gt;
  
  &lt;input type="submit" value="Create" class="btn btn-primary btnSubmitDS" /&gt;
  </code></pre>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>$(document).ready(function () {
      $(".btnSubmitDS").on("click", function (e) {
          var aValue = $("#AValue").val();
  
          alert(aValue);
  
          if (aValue == null || aValue.length() == 0) {
              $(function () {
                  $('#dialog').dialog();
              });
          }
      });
  });
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>#dialog{
      display:none;
  }
  </code></pre>
  
  <p>Now, the correct value is being alerted to the user when the button is clicked but throws an error at the <code>if</code> statement in the JS saying:</p>
  
  <blockquote>
    <p>Function Expected</p>
  </blockquote>
  
  <p>I have tried to recreate this in a <a href="https://jsfiddle.net/yroahL82/" rel="nofollow">JSFiddle</a> and the correct value is being alerted, but the dialog box is not appearing there either, and I did include the jQuery library.</p>
  
  <p>Any help is appreciated.  </p>