Here is my current data:
<tr id="1">
<th>Name</th>
<td>John</td>
<th>Country</th>
<td>US</td>
</tr>
I tried the following:
let rowID = 1;
let columnTitle = "Country";
$('#'+rowID+' td:eq('+columnTitle+')').html("Japan");
Here is what I expect:
<tr id="1">
<th>Name</th>
<td>John</td>
<th>Country</th>
<td>Japan</td>
</tr>
2
Answers
with JQuery you can do this approach:
Since you need the next
td
data afterth
containscountry
, you need to modify your code like below:Working sample: