I have an add Email button, on clicking on that I would like to read all the email address text box values and then pass it to the ajax call. I have the same kind of parent div s repeated once for an applicant context and another for a contact context. I would like to read just only those emails that are near to the clicked button, i.e, if i click Add button under applicant only the emails of the applicant should be read, if i click on button under the contact, only those emails should be read.
Here is html for the applicant
<div id="divEmailPartial">
  <div id="divEmailRows">
  <div class="row" id="divEmail" style="">
    <div class="col-md-4">
            <div class="margin-bottom-10">
                <input class="form-control valid" id="Emails_0__EmailAddress" maxlength="30" name="Emails[0].EmailAddress" type="text" value="">
            </div>
        </div>
    </div>
    <div class="row" id="divEmail" style="">
        <div class="col-md-4">
                <div class="margin-bottom-10">
                    <input class="form-control valid" id="Emails_1__EmailAddress" maxlength="30" name="Emails[1].EmailAddress" type="text" value="">
                </div>
        </div>
    </div>
</div>
<div class="row">
        <div class="col-md-2">
            <button type="button" class="btn btn-link glyphicon glyphicon-plus-sign clsAddEmail" name="actionType" value="AddEmail" id="btnAddEmail"> add</button>
        </div>
</div>
</div>
<div id="divEmailPartial">
  <div id="divEmailRows">
  <div class="row" id="divEmail" style="">
    <div class="col-md-4">
            <div class="margin-bottom-10">
                <input class="form-control valid" id="Emails_0__EmailAddress" maxlength="30" name="Emails[0].EmailAddress" type="text" value="">
            </div>
        </div>
    </div>
    <div class="row" id="divEmail" style="">
        <div class="col-md-4">
                <div class="margin-bottom-10">
                    <input class="form-control valid" id="Emails_1__EmailAddress" maxlength="30" name="Emails[1].EmailAddress" type="text" value="">
                </div>
        </div>
    </div>
</div>
<div class="row">
        <div class="col-md-2">
            <button type="button" class="btn btn-link glyphicon glyphicon-plus-sign clsAddEmail" name="actionType" value="AddEmail" id="btnAddEmail"> add</button>
        </div>
</div>
</div>
Here is my jquery that i used
    var emailsList = new Array();
// if i use this I wouldn't get any thing
    var emailRows = $(this).closest("#divEmailRows :input[type='text']");
    var emailRows = $("#divEmailRows :input[type='text']"); //this includes all inputs (applicants & contacts)
    emailRows.each(function () {
        var email = $(this).val();
        var controlId = $(this).attr("id");
        var controlName = $(this).attr("name");
        emailsList.push({ 'EmailAddress': email, 'ControlId': controlId, 'ControlName': controlName });
    });
    return emailsList;
Kindly help me how to read all the input text values with jquery.
Thanks
Tarak
 
    