Get table row by row index jquery

dasdasd

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.

user3559349

.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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Jquery get row Index

From Dev

Boostrap Table: get the row data by row index

From Dev

how to get a row index in dynamic table via jQuery

From Dev

Jquery get row value in a table

From Dev

Jquery get row value in a table

From Dev

Jquery table row index after move

From Dev

How to get the row index in a HTML table

From Dev

Get index of a table cell relative to the row

From Dev

Get row index from row id and table id

From Dev

jQuery Datatables - How to get the index of a row when a button in that row is clicked

From Dev

jQuery - Get table row count with a certain class

From Dev

Jquery to get table row values of selected checkboxes

From Dev

JQuery : Get div defined in same table row

From Dev

get a row from dynamic table (jquery)

From Dev

get value of a specific row of a table using jquery

From Dev

Get Table Row Column and Header JQuery

From Dev

Get html code of table row with jquery

From Dev

get a row from dynamic table (jquery)

From Dev

How to get every id on a row in a table with jQuery?

From Dev

jQuery - Get data from table row and post it

From Dev

Current row index in table

From Dev

Generating table with jquery row by row?

From Dev

Getting the Row index of a HTML table from table click event - JQuery

From Dev

Get specific value from table with table name, row and column index

From Dev

How do I create table using row & col index in jQuery?

From Dev

Populate a Symfony form row with a table row index

From Java

Add table row in jQuery

From Dev

jQuery each row of a table

From Dev

JQUERY add row to table