Below is the sample td for a dynamic table generated.
I need to iterate through the tds to match the 'Data' values and to check if its corresponding 'Result' value is populated or not.
If the 'Result' is not populated , there will not be span class="taglist" element.
<td class="indent0">
Data1
<span class="aspect-data">
<span class="taglist">Result1</span>
</span>
<td class="indent0">
Data2
<span class="aspect-data">
<span class="taglist">Result2</span>
</span>
I have tried to iterate using the below code, which alerts all the 'Result' values, but I need to get only the corresponding values of a 'Data' given.
$('.indent0').each(function() {
var celltext = $(this).html();
if (celltext = "Data1") {
var spantext = $(this).find(".taglist").html();
if (spantext != null) {
alert(spantext);
}
}
});
if (celltext = "Data1")is assigning ; what you need isif (celltext =="Data1")