title: My javascript will not return a value to the model, preventing the value needed from ever reaching the controller function
body: <p>I have a code that creates a program to send out a mailing list to multiple recipients. I have two different views with dynamic tables as part of the program. One is for the recipients of the mailing list, and the other is to select between different projects. The mailing list table works the way it is supposed to. I have a table with the recipients, that are stored in a database so they are there upon initialization, and at the foot of the table are some textboxes along with an add button and a save button at the very bottom. Whenever I hit the add button I just adds the recipient to the table, but whenever I hit the save button, the table isnt supposed to change, but the database is updated based off of the new entries in the textboxes. It does that by using javascript to get values out of the text entries, and set them to a value in my model. That value is then retrieved from the model by the controller. My issue is in the project list table, when I click save, the javascript is not setting that value it gets from the textboxes to the model value. All I did was copy/paste the html and js code from the mailing list to a new view for the project list, then change the variables.</p>
  
  <p>I have stepped through the code line by line to see that the problem happens when the function $("#paths").val(pathList); is called. I does not assign pathList value to #paths.</p>
  
  <p>HTML code for the mailing list where model values are assigned:</p>
  
  <p>`</p>
  
  <pre><code>&lt;div class="col-md-9"&gt;
          &lt;div class="well-lg bordered" style="max-width:600px;"&gt;
              &lt;div style="max-width:500px; margin-right:auto; margin-left:auto;"&gt;
                  &lt;form method="post" role="form"&gt;
                      &lt;input asp-for="Names" id="names" type="hidden" value="" /&gt;
                      &lt;input asp-for="Emails" id="emails" type="hidden" value="" /&gt;
                      &lt;div class="form-group"&gt;
                          &lt;class ="row"&gt;
                              &lt;class ="column"&gt;&lt;label&gt;Mailing List&lt;/label&gt;
                              &lt;class ="column" &gt;&lt;/class&gt;&lt;a href="https://localhost:44355/Home/Release"&gt;&lt;font color="#1974D2"&gt;Back&lt;/font&gt;&lt;/a&gt;
                          &lt;div class="table-responsive bg-white"&gt;
                              &lt;table class="table bordered" id="dynamic-table"&gt;
                                  &lt;thead&gt;
                                      &lt;tr class="bg-clubcar"&gt;
                                          &lt;th width="35%"&gt;Name&lt;/th&gt;
                                          &lt;th width="45%"&gt;Email&lt;/th&gt;
                                          &lt;th width="20%"&gt;Edit&lt;/th&gt;
  </code></pre>
  
  <p>`</p>
  
  <p>JAVASCRIPT code for the mailing list:</p>
  
  <pre><code>`
  
  $(function () {
          $("#butSubmit").click(function () {
              var nameList = [];
              var emailList = [];
  
              $("#dynamic-table tr:not(:first, :last)").each(function () {
                  var tdlist = $(this).find("td");
                  var name = $(tdlist[0]).html();
                  var email = $(tdlist[1]).html();
                  nameList.push(name);
                  emailList.push(email);
              });
              $("#names").val(nameList);
              $("#emails").val(emailList);
          });
      });
  </code></pre>
  
  <p>`</p>
  
  <p>HTML code for project list where model values SHOULD be assigned:</p>
  
  <p>`</p>
  
  <pre><code>&lt;div class="col-md-9"&gt;
          &lt;div class="well-lg bordered" style="max-width:1000px;"&gt;
              &lt;div style="max-width:900px; margin-right:auto; margin-left:auto;"&gt;
                  &lt;form method="post" role="form" &gt;
                      &lt;input asp-for="ProjectNames" id="projectNames" type="hidden" value="" /&gt;
                      &lt;input asp-for="Paths" id="paths" type="hidden" value="" /&gt;
                      &lt;div class="form-group"&gt;
                          &lt;class ="row"&gt;
                              &lt;class ="column"&gt;&lt;label&gt;Project List&lt;/label&gt;
                                  &lt;class ="column"&gt;&lt;/class&gt;&lt;a href="https://localhost:44355/Home/Release"&gt;&lt;font color="#1974D2"&gt;Back&lt;/font&gt;&lt;/a&gt;
                                  &lt;div class="table-responsive bg-white"&gt;
                                      &lt;table class="table bordered" id="dynamic-table2"&gt;
                                          &lt;thead&gt;
                                              &lt;tr class="bg-clubcar"&gt;
                                                  &lt;th width="35%"&gt;Project Name&lt;/th&gt;
                                                  &lt;th width="55%"&gt;File Pathways&lt;/th&gt;
                                                  &lt;th width="10%"&gt;Edit/Delete&lt;/th&gt;
                                              &lt;/tr&gt;
  </code></pre>
  
  <p>`</p>
  
  <p>JAVASCRIPT code for the project list:</p>
  
  <pre><code> `
  
  $(function () {
          $("#butSubmit1").click(function () {
              var projnameList = [];
              var pathList = [];
  
              $("#dynamic-table2 tr:not(:lt(2), :last)").each(function () {
                  var tdlist = $(this).find("td");
                  var projname = $(tdlist[0]).html();
                  var path = $(tdlist[1]).html();
                  projnameList.push(projname);
                  pathList.push(path);
              });
              $("#projectnames").val(projnameList);
              $("#paths").val(pathList);
          });
      });
  </code></pre>
  
  <p>`</p>
  
  <p>I should be getting a value consisting of a list of all paths set to id="paths" which sets the value to my model "Paths". "Paths" is always null after the Javascript has run.</p>