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.
muscle$("#muslce_order_table");rob = $('somestuffwhichnotthere'); console.log(rob == null);givesfalserow = table.find('tr').eq(index);rowsis not a jQuery method.