2
I have the following structure below HTML,.
<tr>
<td class="descricao">Texto01</td>
<td class="btn-l"><button type="button">Leitura Confirmada</button></td>
</tr>
<tr>
<td class="descricao">Texto02</td>
<td class="btn-l"><button type="button">Leitura Confirmada</button></td>
</tr>
<tr>
<td class="descricao">Texto02</td>
<td class="btn-l"><button type="button">Leitura Confirmada</button></td>
</tr>
I have even made suggested implementation, but it makes me all TR elements within the table tag. I am not running fução by clicking. Code: var descricatDoc = $('[type=button]'). Closest('tr'). find('td.Description'). text();
– Rafael Luz
Yes, it is the expected one. You are selecting all buttons and searching for all descriptions. If you use
click
as I used, will only pick up the description oftr
of the button clicked. That’s why$(this)
, because it refers to the button just clicked, and not all others.– fernandosavio