Using jQuery in a SharePoint environment, I am trying to append an object property as a last column of a table.
I am using the following JavaScript:
var id = ctx.CurrentItem.ID; //Gets IDs for items in list
console.log(id);
$(".ms-vb-lastCell").append("<td role='gridcell' class='ms-vb-cellstyle ms-vb2'>" + id + "<td>")
The DOM tree for a table row:
<tbody>
<tr class=" ms-itmHoverEnabled ms-itmhover" oncontextmenu="return ShowCallOutOrECBWrapper(this, event, false)" iid="244,1,0" id="244,1,0" role="row">
<!--iid and id are dynamically generated on load-->
<td role="gridcell" class="ms-cellstyle ms-vb2">Completed</td>
<td role="gridcell" class="ms-cellstyle ms-vb2">(2) Normal</td>
<td role="gridcell" class="ms-cellstyle ms-vb2"><span class="ms-noWrap" title="3/30/2018">3/30/2018</span></td>
<td role="gridcell" class="ms-vb-lastCell ms-cellstyle ms-vb2">
<div style="background: #F3F3F3; display:block; height: 15px; width: 120px;">
<div style="background: #00539B; height: 100%; width: 100%;"></div>
</div> 100 %
</td>
</tr>
</tbody>
How can I append each items id to the last td
in each row.