title: Getting the value of appended textboxes on change in JQUERY
body: <p>Need Help.</p>
  
  <p>How can I get the value of appended textboxes having the same classname ? Kindly find the code snippet.</p>
  
  <p>JS : </p>
  
  <pre><code>var count = document.getElementsByName("emailId[]").length; //get the totol no. of contact no. elements
  //function to add a new element for entering emailId 
  $("#add-email-id").click(function () {
      $("#email-id-container").append('&lt;div id="emailAddress_container_' + count + '" style="margin-top:8px"&gt;&lt;input type="text" name="emailId[]"  id="email_address_' + count + '" data-toggle="tooltip" title="Enter Email address here" placeholder="example@example.com" size="30" onBlur="ValidateEmail(' + count + ');" class="emailId"&gt;&lt;span&gt;&lt;input class="username" id="username_' + count + '" name="username[]" value="username" /&gt;&lt;/span&gt;&lt;span style="margin-left:8px;"&gt;&lt;a href="javascript:void(0);"  class="delete-email-id" style="color:#F00;"&gt;(-)&lt;/a&gt;&lt;/span&gt;&lt;span id="email_err_' + count + '"&gt;&lt;/span&gt;&lt;/div&gt;');
      count++; //increment the counter as new contact element is being added.
  });
  
  $(document).ready(function () {
      $('.emailId').change(function () {
          var usernameDiv = $(this).parent("div").find(".username").attr("id"); //get the div where the truncated username will be placed
          alert($(this).attr("id"));
          alert($("#" + usernameDiv).val());
          var emailAddress = $(this).val();
          var truncatedValue = emailAddress;
          var name = "";
          if (emailAddress.indexOf("@") != -1) {
              ///alert("@");      
              name = $.trim(emailAddress.split("@")[0]);
              //alert(name);
              if (name &amp;&amp; name.search(/\s/) === -1) {
                  var len = name.length;
                  //alert(len);
                  if (len &gt; 4) {
                      truncatedValue = name.substring(0, 3);
                  }
                  usernameDiv.val(truncatedValue);
              } else {
                  usernameDiv.val("username");
              }
          }
      });
  });
  </code></pre>
  
  <p>I need to get the value of the email_address field and then get the truncated value in the appropriate username field appended. </p>