I am trying to apply the class ".lightGray" that i defined earlier on to div 4,5,7,and this current one. Not sure what I am doing wrong!
$("#Div8").click(function(){$("#Div4", "#Div5","#Div7","#Div8").addclass(".lightGray");});
In all DIVS these I put a default class: changeClass
, and maintain their individual IDS.
A instead of doing $("#Div4","#Div5","#Div7","#Div8")
would suffice to make $(".changeClass).addClass("lightGray");
Classes can be used in more than one element at the same time and thus can manipulate several of these elements at once, saving time and lines of code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With