I want to access row in my table using the row index.
When I try to get the row by is index I get :
Uncaught TypeError: undefined is not a function
This is my code:
function moveUpMuscle(muscleIdFrom, muscleOrderFrom, index)
{
if(index == 0)
{
alert("Muscle is already at the top of the list");
return;
}
table = $("#muslce_order_table");
console.log(table == null ? "null" : "not null");
row = table.rows(index);
muscleIdTo = row.attr("data-id");
muscleOrderTo = row.attr("data-order");
console.log("muscleIdFrom " + muscleIdFrom + " muscleOrderFrom " + muscleOrderFrom);
console.log("muscleIdTo " + muscleIdTo + " muscleOrderTo " + muscleOrderTo);
}
The error points to this line:
row = table.rows(index);
In my console the log is "not null" so the table
element is not undefined.
.rows
is not a jQuery method. Change your code to retrieve the row as follows
row = table.find('tr').eq(index);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments