I am also experiencing the same problem. any tips?
On Apr 3, 7:23 am, Rob Lacey <cont...@robl.me> wrote: > Hi there, > > I'm getting an interesting problem with addClass and removeClass. I'm > attempting to build a rating system using radio buttons to select the > rating. I'm actually hiding my radio buttons and styling the label to > have pretty stars instead for a nicer interface. I want to highlight the > star when the radio button is selected, so when the label is clicked by > adding the 'active' class. I also need to remove the 'active' class from > all other labels so that only one is selected at any one time. > > I assumed that removing the class from all of them and then re-adding > for the one I am clicking would be the most efficient way for doing this > like so. > > jQuery(document).ready(function () { > jQuery('label.star').click(function (event) { > jQuery('label.star').removeClass('active'); > jQuery(event.target).addClass('active'); > }); > > }); > > However this now has no effect, the class is simply not added at all now. > > Anyone got any ideas why this doesn't work? > > Cheers > > RobLhttp://www.robl.me