0
I have a button
that sends the form, and inside the form have the respective fields, inside the fomulário has a table that brings dinanmicamente the data of the database that is allows editing of the values of each line:
$("#update-baixa").click(function () {
var item = $("[data-idparcela]").closest("tr").children('td:eq(1)');
console.log(item.val());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="tablemdlreceita" class="table table-sm table-bordered table-responsive">
<thead>
<tr>
<th>Documento</th>
<th>Vlr Programado</th>
<th>Dt Vencto</th>
<th colspan="2" class="text-center">Ações</th>
</tr>
</thead>
<tbody><tr>
<td>FR212</td>
<td>220.00</td>
<td>30/01/2019</td>
<td align="center">
<a class="omdleditreceita" data-idparcela="3">Editar</a>
</td>
</tr>
<tr>
<td>FR212</td>
<td>400.00</td>
<td>25/01/2019</td>
<td align="center">
<a class="omdleditreceita" data-idparcela="4">Editar</a>
</td>
</tr>
</tbody><tbody>
<tr>
<td colspan="9" align="center">
<div class="pagination-wrap">
<ul class="pagination"><li><a href="/add-data.php?page_no=1" style="color:red;">1</a></li></ul>
</div>
</td>
</tr>
</tbody>
</table>
<button type="button" id="update-baixa" class="btn btn-primary"><span class="fas fa-plus"></span>Salvar</button>
Only it is not taking the individual value of each td of the column |Vlr Programmed|
Change: Closest to parents and val() to text().
– Maujor
Sure he did, but he’s taking the value of line two only. I need it to take the value of line 1 so I can store in a variable and after line two and do the same.
– JB_
He’s only picking up one line because it’s set the
td:eq(1)
. Remove theeq
and treat the return as a array.– Valdeir Psr