I have this code and I want to be able to strikethrough the text in the same row. Can I use the row index (or the record id number on a data attribute) to get at the correct task description?
Here is my code:
function CompleteTask(x)
{
var row = x.parentNode.parentNode;
var customerid = $('#DeleteTask').data('id');
var table = document.getElementById('tasks_table');
var rows = table.getElementsByTagName('tr');
var rowIdx = row.rowIndex;
var selectedRow = rows[rowIdx];
var Description = selectedRow.getElementsByClassName("TaskDescription");
var values = selectedRow.cells;
var col = selectedRow.cells[1].innerHTML;
var checkbox = values[0].innerText;
var tasktext = values[1].innerText; row.cells[1].className
if ($("#checkbox").is(':checked'))
{
$("#TaskDescription").css('text-decoration', 'line-through'); // works but only on first line of table. Would like to use row index if possible please
}
}
Thanks
Stew