I'm binding div dynamically. Please see the below image. When I'm clicking on Update button I need to get current row cell values. How can i achieved that through jQuery or JavaScript? I tried this way var InputVal = $(this).closest('.row');
<div class="Row">
<input type="hidden" id="hid_2167" value="200">
<div class="Cell2">eztest</div>
<div class="Cell1" id="edit_2167_8053" style="display: table-cell;">
<input class="text-box single-line" data-val="true" data-val-length="The must not be blank" data-val-length-max="20" id="DeviceMappingList_12__FirstName" name="DeviceMappingList[12].FirstName" type="text" value="j"></div>
<div class="Cell" id="disp_2167_8053" style="display: none;">
j
</div>
<div class="Cell1" id="edit_2167_8053" style="display: table-cell;">
<input class="text-box single-line" data-val="true" data-val-length="The field LastName must be a string with a maximum length of 20." data-val-length-max="20" id="DeviceMappingList_12__LastName" name="DeviceMappingList[12].LastName" type="text" value="d"></div>
<div class="Cell" id="disp_2167_8053" style="display: none;">
d
</div>
<div class="Cell1" id="edit_2167_8053" style="display: table-cell;">
<input class="text-box single-line" data-val="true" data-val-length="The field Email must be a string with a maximum length of 30." data-val-length-max="30" id="DeviceMappingList_12__Email" name="DeviceMappingList[12].Email" type="text" value="jd"></div>
<div class="Cell" id="disp_2167_8053" style="display: none;">
jd
</div>
<div class="Cell1" id="edit_2167_8053" style="display: table-cell;"><input class="text-box single-line" data-val="true" data-val-length="The field MobileNumber must be a string with a maximum length of 20." data-val-length-max="20" id="DeviceMappingList_12__MobileNumber" name="DeviceMappingList[12].MobileNumber" type="text" value="085"></div>
<div class="Cell" id="disp_2167_8053" style="display: none;">
085
</div>
<div class="Cell">
Alan
<input id="DeviceMappingList_12__UserName" name="DeviceMappingList[12].UserName" type="hidden" value="Alan">
</div>
<div class="Cell1" id="edit_2167_8053" style="display: table-cell;"><input altid="hid_2167" checked="checked" data-val="true" data-val-required="The IsActive field is required." id="DeviceMappingList_12__IsActive" name="DeviceMappingList[12].IsActive" onclick="return checkrows(this)" type="checkbox" value="true"><input name="DeviceMappingList[12].IsActive" type="hidden" value="false"></div>
<div class="Cell" id="disp_2167_8053" style="background-color: lightgreen; display: none;">
<a href="#" onclick="changeDeviceStatus(2167,8053,'True','eztest')">Deactivate</a>
</div>
<div class="Cell2">21/11/2019 09:49:12</div>
<div class="Cell2">9DF2573B-DEF7-455C-9625-517DBED8556F</div>
<div class="Cell2">2.3.23</div>
<div class="Cell2">13.3.1</div>
<div class="Cell2">iPad (5th Gen) (Wi-F</div>
<input style="display:none" type="checkbox" name="chkdeviceId" id="chkdeviceId" chkid="chk_2167_8053" value="8053">
<input style="display:none" type="checkbox" name="chkcompanyId" id="chkcompanyId" chkid="chk_2167_8053" value="2167">
<div class="Cell3">
<a href="" id="aedit" onclick="return editDeviceDetails(this,2167,8053)">cancel</a>
<a href="#" style="display: block;" id="update_2167_8053" onclick="updatedevicedetails(2167,8053,eztest,j,d,jd,085 )">Update</a>
<a href="" id="adelete" onclick="return deleteDevice(this,2167,8053,'eztest','iPad (5th Gen) (Wi-F')">delete</a>
</div>
</div>
I got this code and resolved. Thank you !
var row = $(this).closest('.Row');
console.log(row.find('[id*=__FirstName]').val());
console.log(row.find('[id*=__LastName]').val());
console.log(row.find('[id*=__Email]').val());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.