After reviewing the question and demo,
How to compare several td.text() in tr using jQuery
https://jsfiddle.net/lmgonzalves/cqa6m6va/1/
It demonstrated how to detect duplicates within td elements.
My issue is figuring out how to achieve the same with select elements inside a td:
<td style="max-width:160px" class="ellipsis">
<select class="select make-long-select fieldEditable ddSample" style="display:none;" name="sampleName">
<option value="SampleValue1">SampleValue1</option>
</select>
<span class="lblSample lblCurrentValue">SampleValue1</span>
</td>
<!-- Other similar table cells -->
I need to replicate the same comparison behavior as shown in the previous question for this script.
I attempted the following approach but it did not work:
tds = $(this).find('td.ddSample');
tds.each(function(j, elem1){
tds.each(function(k, elem2){
if($(elem1)[0] != $(elem2)[0] && $(elem1).text() == $(elem2).text()){
$(elem1).addClass('cl');
}
});
});
Note: I specifically want to compare data within ddSample (assuming other data exists within the tr).