I ahve a jquery code that get the siblings of a table td text.
How can we put that text into variables?
jQuery("tbody tr").each(function() {
jQuery("td:not(:first)",this).click(function() {
alert(jQuery(this).siblings().text());
});
});
<table>
<thead><td>A</td><td>B</td></thead>
<tbody>
<tr><td class="aclass">A</td><td class="bclass">B</td></tr>
</tbody>
</table>
Set siblings as variable:
var txtA = jQuery(this).find(".aclass").text();
var txtA = jQuery(this).find(".aclass").text();
You could add the texts in array: