Home › Forums › JavaScript › Trying to add another addClass(); when element is clicked in jQuery › Re: Trying to add another addClass(); when element is clicked in jQuery
December 20, 2012 at 8:29 pm
#118340
Member
I think you’re going about it wrong. Instead of changing `.val-google` to `.active-google` you could just focus on the parent class/hover state. Change all of the values to just have a common class like ‘.value’, then you you can change the style of it based on its parent:
.li:hover .value, .this-item-is-dropped-down .value {
/* styles */
}
In fact, you should be removing the majority of jQuery that you’re using. Let’s see if I can whip up a quick Pen…