I am trying to get the current column value in keypress event given in javascript. Here is the code
$(document).ready(function () {
$("td").keypress(function (e) {
var tr = $(this).parents('tr');
var rownumber = tr.index();
var colname = $(this).attr("class");
});
if(colname == 'HolidayHrs')
{
var holidayhrs = the column value of the current row
}
})
<table>
<tr>
<td class="HolidayHrs"><a href="#" data-pk="HolidayHrs">@Model.attendanceLogList[i].HolidayHrs</a><input asp-for="@Model.attendanceLogList[i].HolidayHrs" type="hidden" class="bros"/></td></td>
</tr>
</table>