3
How do I get a value from a <td>
by clicking on a checkbox
that is in the same <tr>
in jquery
Follows my code:
HTML
<table style="display:none;" id="tableTime">
<tr>
<td class="hora">08:00</td>
<td class="eventoAgenda" id="0800"></td>
<td class="idEvento" id="id0800"></td>
<td class="statusVerde01"> <input id="iStatusVerde01" class="iStatusVerde" type="checkbox" style="width: 15px;" ></input> </td>
</tr>
<tr>
<td class="hora">08:30</td>
<td class="eventoAgenda" id="0830"></td>
<td class="idEvento" id="id0830"></td>
<td class="statusVerde02"> <input id="iStatusVerde02" class="iStatusVerde" type="checkbox" style="width: 15px;"></input> </td>
</tr>
jquery
$('.iStatusVerde').click(function() {
var teste = $('#tableTime tr td').parent().find(':nth-child(3)').html()
console.log(teste);
I tried this way, but it only works with the value of the first line, and I have several other lines. In this example I’m trying to get the value of the third column.
very good your example.. worked exactly the way I needed.. thanks
– Fernando Fefu