So, I have this jQuery function that checks if a particular div has a corresponding βredβ class. However, I want to know how I can do this so that it checks mutliple Divs not only div "# Drop1".
I have 4 Divs in total from # Drop1 to # Drop4.
I want to make it work so that it checks all 4 Divs for the "red" class, and if any div has this class, display a warning message.
I looked around and did not seem to find a specific answer.
$("Button").click(function(){ if ( $("#Drop1").hasClass("red") ) { alert("one of your Divs has the class red"); } });
source share