Hi,
How to looping through table each row in jquery
I am trying to loop like below but its taking all tr's at a time but i want to loop each tr and try to find out there subject, schoollevelid, selectedcourseids
var TutorscourseDetails = new Array();
var TutorcourseDetails = {};
$("#tbl_TutorcoursList, tblBody_TutorcoursList tr").each(function (index,course) {
debugger;
var row = $(this);
TutorcourseDetails.SubjectId = row.find("[name=subId]").text();
TutorcourseDetails.SchoolLevelId = row.find("[name=sclevlId]").text();
TutorcourseDetails.selectedCourseIDs = row.find("[name=selectdcoursId]").text();
TutorscourseDetails.push(TutorcourseDetails);
});
<div class="row">
<div class="col-sm-12">
<table id="tbl_TutorcoursList" style="table-layout:fixed;word-wrap:break-word" class="table table-hover table-bordered table-striped table-responsive">
<thead>
<tr>
<th>Subject</th>
<th hidden>SubjectId</th>
<th>School level</th>
<th hidden>School levelId</th>
<th>Course</th>
<th hidden>CourseId</th>
<th>Subject Priority</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="tblBody_TutorcoursList"></tbody>
</table>
</div>
</div>
let tab = $('#tblBody_TutorcoursList');
tab.append('<tr><td name="sub">' + Tutor.Subject + '</td><td hidden name="subId">' + Tutor.SubjectId + '</td><td name="sclevl">' + Tutor.SchoolLevel + '</td><td hidden name="sclevlId">' + Tutor.SchoolLevelId + '</td><td name="selectdcours">' + Tutor.CourseName + '</td><td hidden name="selectdcoursId">' + Tutor.CourseID + '</td><td></td><td><button type=button onclick= "TutorCourseEdit(this)"; class="btnedit" data-id=' + _nextId + '>Edit</button></td><td><button type="button" onclick= "TutorCourseDelete(this)"; class="btndelete" data-id=' + _nextId + '>Delete</button></td></tr>');
I am appending trs like above
could you please help me in this as soon as possible?