I’m working on a page where there’s about 6 divs with the same class of “bar”, but the width of each div is dynamically changing based on user’s input. What I need to do now is to change the color of any div that is 250px in width and with the class of “bar”. My concept is as followed:
if($('.bar').width() == 250) {
$(this).addClass('barColor');
}
else {
$(this).removeClass('barColor');
}
That’s basically my concept but I don’t know how to achieve the effect. It will be greatly appreciated if anyone could help
Thank you.
1 Answer