title: add text to an asp.net textbox control with jQuery
body: <p>Within an web form I have a some input fields </p>
  
  <pre><code>&lt;div id="search1"&gt;
          &lt;div class="forminput"&gt;
              Label 1&lt;br /&gt;
              &lt;input type="text" name="Field1" value="" size="20" /&gt;
          &lt;/div&gt;
          &lt;div class="forminput"&gt;
              Label 2&lt;br /&gt;
              &lt;input type="text" name="Field2" value="" size="20" /&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As focus is lost on the control the value entered needs to be returned to an asp.net textbox control. I have been able to pass the values to a div layer or standard html element using the following code: </p>
  
  <pre><code>    function fieldUpdate() {
  
              var currentValue = $(this).val();
              var field = $(this).attr("name");
  
                  if (currentValue != "") {
                      $("#results").append(field + ":" + currentValue + "+");
                  }
          }
   $(function () {
              $("#search1 :input[type=text]").focusout(fieldUpdate);
  
          });
  </code></pre>
  
  <p>However this does not seem to work with an asp.net server side control. 
  <strong>Update</strong>
  The objective of this question is to provision the values entered into standard html input fields into an asp:textbox control</p>
  
  <pre><code>&lt;asp:TextBox ID="results2" Text="" Width="400" runat="server" /&gt;
  </code></pre>
  
  <p><strong>Update</strong>
  Below is a screenshot of how the current solution works. At the top you see teh input fields as a user enters a value and tabs out of each field this value is added to a Div layer labeled results. What I want to do is instead of adding the fieldname and value to a DIV element I want them to instead be added to a asp:textbox control. </p>
  
  <p><img src="https://i.stack.imgur.com/yXLLz.png" alt="enter image description here"></p>
  
  <p>It is preferred to have this code stored within an external js file vs within the aspx page.</p>
  
  <p>Can anyone provide any suggestions on how to accomplish this?</p>
  
  <p>thanks in advance</p>
  
  <p><strong>Update Solution</strong>
  Thanks to James for helping me work though this. Below is the jQuery code as used in the current implementation.</p>
  
  <pre><code>function fieldUpdate() {
  
              var currentValue = $(this).val();
              var field = $(this).attr("name");
              var txt = $("#&lt;%=results2.ClientID%&gt;");
                  if (currentValue != "") {
                      $("#results").append(field + ":" + currentValue + "+");
                      if (txt) {
                          txt.val(txt.val() + field + ":" + $(this).val() + "+");
                      }
                  }
          }
  
  
          $(function () {
          //only evaluate input text field
              $("#search1 :input[type=text]").focusout(fieldUpdate);
  </code></pre>
  
  <p>This will now allow an asp:textbox to be populated with the input field name and value. 
  Example Field1:foo+Field2:somevalue2+Field3:somevalue3 ... </p>