title: Submit form through triggering jQuery submit button not working
body: <p>I have a page that has form. I have a window.setTimeout that will call a function that trigger the submit button. The timeout is set to 10 seconds. However if the time has elapsed the function is called but the form is not submitted. It seems the submit button is not submitting the form. Please help how to make this function work. I want that if the function "SubmitForm" is called it will submit the button without clicking the submit button. Below is my code.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>@model MVCViewState.Models.Product
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Create&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
          window.setTimeout(SubmitForm, 10000);
          function SubmitForm() {
              alert('called');
              $('#btnSubmit').submit();
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt;
      @using (Html.BeginForm("Create", "Products", FormMethod.Post, new { id = "ProductForm" }))
      {
          @Html.ValidationSummary(true)
          &lt;fieldset&gt;
              &lt;legend&gt;Product&lt;/legend&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.Name)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.Name)
                  @Html.ValidationMessageFor(model =&gt; model.Name)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.Description)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.Description)
                  @Html.ValidationMessageFor(model =&gt; model.Description)
              &lt;/div&gt;
              &lt;p&gt;
                  &lt;input type="submit" value="Create" id="btnSubmit"/&gt;
              &lt;/p&gt;
          &lt;/fieldset&gt;
      }
      &lt;div&gt;
          @Html.ActionLink("Back to List", "Index")
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <p>//
          // POST: /Products/Create</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(Product product)
      {
          try
          {
              List&lt;Product&gt; products;
              if (Session["products"] != null) products = Session["products"] as List&lt;Product&gt;;
              else products = new List&lt;Product&gt;();
              if (products != null) products.Add(product);
              product.Id = products.Max(x =&gt; x.Id) + 1;
              Session["products"] = products;
              return RedirectToAction("Index");
          }
          catch
          {
              return View();
          }
      }
  </code></pre>