I have the following loop :
$('.sampleAddress li span').filter(function() {
var currentLine = $.trim($(this).html().replace(/ /g, '')).toUpperCase();
var unmatched = $.trim(unmatchedLine.replace(/ /g, '').toUpperCase().replace("&", "&"));
if (currentLine.indexOf(unmatched) !== -1) {
$(this).html($(this).text().replace(" ", " ").replace("&", "&").replace(unmatchedLine.toUpperCase(), '<span class="matchedClass">' + unmatchedLine.toUpperCase() + '</span>'));
}
});
I am just wondering how I could traverse this list in reverse order and exit the loop within the if statement ?