title: Why dynamically added views input field failed to attach jQuery event on main view
body: <p>Adding partial views dynamically into the main view on button click like the following , dynamically loaded views input failed to attach jQuery on main view but they this attachment work perfectly on partial views.</p>
  
  <p><strong>Main view</strong></p>
  
  <pre><code> &lt;input type="button" name="BtnAddNew" value="Add New" onclick="AddCustomer();" /&gt;
  
      &lt;script&gt;
          function AddCustomer() {
              $.get("DataEntryScreen").done(function (r) {
                  $('#DivDatEntry').html(r);
              });
          }
  
          $('#btnCancel').click(function (e) {//not work on main view
              alert();
              $('#DivDatEntry').html("");
          });
  
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>Partial view=DataEntryScreen.cshtml</strong></p>
  
  <pre><code>@{
      AjaxOptions o = new AjaxOptions();
      o.OnSuccess = "OnSaveSuccess";
  }
  @using (Ajax.BeginForm("SaveCustomer", "SPA", o))
  {
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;Customer Name:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="CustomerName" value="" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Address:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="Address" value="" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Age:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="Age" value="" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td colspan="3" align="right"&gt;
                  &lt;input type="submit" name="name" value="Save" /&gt;
                  &lt;input type="button" name="name" value="Reset" /&gt;
                  &lt;input id="btnCancel" type="button" name="name" value="Cancel" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  }
  </code></pre>
  
  <p>Now dynamically loaded partial view="<strong>DataEntryScreen.cshtml</strong>"  button="<strong>btnCancel</strong>"
  attach jQuery event on the main view is not work, then writing the same jQuery syntax on correspondent partial view work perfectly.</p>
  
  <pre><code>&lt;script&gt;
  
  
      $('#btnCancel').click(function (e) {//perfectly work on partial view.
          alert();
          $('#DivDatEntry').html("");
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Why jQuery event attachment not work on main view?</p>