I have a scenario where I have dynamically added several divs with a specific class to my webpage. These divs change color when the user hovers over them. I am trying to trigger a specific function once the last div has been set to a particular background color, but despite my efforts, I have not been successful so far. Any insights or help would be greatly appreciated. Here is the code snippet from my latest attempt:
var counter=0;
$(".orb").each(function () {
if ($(this).css("background-color") === "#ede74a") {
counter=counter+1;
}
});
if (counter === orbarray.length) { //all backgrounds have been set
executeFunction();
}