I have a table ...
<table id="tblTransactions" class="table table-striped">
<thead>
<tr>
<th class="col-md-1">Date</th>
<th class="col-md-4">Description</th>
<th class="col-md-2">Debit</th>
<th class="col-md-2">Credit</th>
<th class="col-md-3">Category</th>
</tr>
</thead>
<tbody>
<c:forEach items="${transactions}" var="element">
<tr>
<td><fmt:formatDate pattern="dd/MM/yyyy" value="${element.tranDate}"/></td>
<td class="colTranDesc">${element.tranDescription}</td>
<td>${element.debit}</td>
<td>${element.credit}</td>
<td class="colCategory"><input type="text" class="eetag" name="tag"></td>
</tr>
</c:forEach>
</tbody>
</table>
After loading the page, I want to set a value for each entry for each td with the class "colCategory".
I would like the selector to look something like this, but I have problems with the syntax ...
$("#tblTransactions > tbody > tr > td > input.colCategory").each(function(){
var elt = $(this).val("Phone");
});
Can someone help me with this syntax please. Or, if there is an easier way to do this, I am open to suggestions.
THX
source
share