martinbshp martinbshp - 26 days ago 7
jQuery Question

How do I add aditional class on hover in jQuery

I have several circles with a css class of rating-circle and I want to add an additional class. Here is the code I'm using.

$(function () {

//change class on hover

$('.rating-circle').hover( function() {
$('.rating-circle')addClass('rating-hover');
});
});


What did I miss?
Thank you.

Answer

you forgot the dot

$('.rating-circle').addClass('rating-hover');

Small advice: Use some developer tool when you are working in frontEnd, and those minor mistakes are really easy to fix :)