First of all here is a jsFiddle example of my problem: http://jsfiddle.net/xJtAr/
I got many div-elements on my site and some of them have a class “number” and only one of them has the class “active_question” which should change they grey border from the number-class to a black border. When the user clicks on one of those elements this one shall get the class “active_question” and this class should be removed from the old div with this class.
The script I wrote in jQuery seems to work fine but there is no visual effect as it should be.
I would be very thankful if someone could help me.
You included the
.in the various jQuery class methods. This is just the CSS selector and not the class.So instead of
$(this).addClass('.active_question')you want$(this).addClass('active_question')Edited your fiddle:
http://jsfiddle.net/xJtAr/1/