I am trying to access the td element from a table,based on selected id via check boxes, the idea is that I check multiple check boxes and then from the value="@item.id" I use the value to check for their tr and then finally access the td. What I want is to get the Status so that I can do a dialog message pop up. Status is the 5th td in the table row.
Not sure if this is a good design to go about it.
I have tried something with this How to get a table cell value using jQuery? but I am not getting the correct values, it outputs something like "< alot of spaces ....> Approved".
e.g. use case: Annual Leaves has been approved/rejected, user selected some approved leaves and tries to approve and then a warning modal pop up will prompt user to that "Cannot approve approved leaves or reject rejected leaves again". Below is my original script without the stuff from the url.
@foreach (var item in Model)
{
<tr>
<td align="center">
<input type="checkbox" name="chkSelectAll" id="chkSelectAll" value="@item.Id"/>
</td>
<td align="center">
@Html.DisplayFor(modelItem => item.UserId)
</td>
<td align="center">
@Html.DisplayFor(modelItem => item.Name)
</td>
<td align="center">
@Html.DisplayFor(modelItem => item.StartDate)
</td>
<td align="center">
@Html.DisplayFor(modelItem => item.StartSlot)
</td>
<td align="center">
@Html.DisplayFor(modelItem => item.Status)
</td>
</tr>
}
<script>
function multiSelect(selectedArray, action)
{
if (selectedArray[0] === undefined) {
$.fn.bootstrapBtn = $.fn.button.noConflict();
$(function () {
$("#dialog-warning").dialog({
modal: true,
buttons: {
Ok: function () {
$(this).dialog("close");
}
}
});
});
}
}
</script>