I am doing an MVC with C# application. I was trying to access the entire row in a table and change the values in each cell using jquery.
I need to do change the value in each td once a json call is succeeded.
Please advice for this
I am doing an MVC with C# application. I was trying to access the entire row in a table and change the values in each cell using jquery.
I need to do change the value in each td once a json call is succeeded.
Please advice for this
Let's say 'ID' of your table is 'myTable'.
$.getJSON('http://yourpageurl.com',
function(data)
{
//Let's say you want to modify all the cells in the first row.
$('#myTable tr:first td')
.each(
function()
{
//'this' represens the cell in the first row.
$(this).html('changing cell value');
}
);
//If you want to access all cells of all the rows, replace
//#myTable tr:first td with
//'#myTable td'
}
);
EDIT:
If you know 'id' for your tr, you can replace
'#myTable tr:first td' selector with '#<>' replace <> with your TR id.