I have a list that can sometimes contain 5 elements, other times it may have 7. I want to determine the number of elements and apply a special style to those with less than 5. The current code I have is not working as expected... Perhaps I need to implement live checking? Additionally, I've set up a time interval for delayed checking. Thank you in advance for any assistance.
setTimeout(function(){
var single_producer_products_list = $('.single_producer_products_list').find('li');
if ((single_producer_products_list < 7)) {
$('.producer_series_info').addClass('longer');
}
},200)