ketom ketom - 3 months ago 9
jQuery Question

How to get table row by id and then change it's value / html

I have a table its generated by jquery.

<table id="redTable" class="rwd-table table-centered">
<thead>
<tr>
<th>aaa</th>
<th>bbb</th>
<th>ccc</th>
<th>ddd</th>
<th>eee</th>
<th>fff</th>
</tr>
</thead>
<tbody>

<tr id="46603693">
<td><span>Image cell</span></td>
<td><span>Loading</span></td>
<td><span>Loading</span></td>
<td><span>Loading</span></td>
<td><span>Loading</span></td>
<td><span>Loading</span></td>
</tr>
<tr id="30041170">
<td><span>Image cell</span></td>
<td><span>Change it to Image</span></td>
<td><span>Loading</span></td>
<td><span>Change it to 10</span></td>
<td><span>Loading</span></td>
<td><span>Loading</span></td>
</tr>
</tbody>
</table>


I want to search a row where id equal 30041170;
Than i want to change the cells value.
I tried
$('#id').find('30041170')
it. Maybe i got the row with this.

Its fine? If fine, how can i change the cells?

Sorry about this, I am newbie in frontend jq, and its so hard for me.
I hope someone can help me.
Thanks so much!

Answer
$('#30041170 td span').eq(1).html('Image');
$('#30041170 td span').eq(3).html('10');
Comments