Thursday 8 August 2013

jQuery - only active menu item will change

jQuery - only active menu item will change

I'm beginner with jQuery and I would like to change background color to
active menu item but and I don't know how. If I select some item
background will change but if I select another item, in the previously
item stay still "active background color" and I want to change back to
default color and only active menu item will be changed.
This is static menu now but I will rebuilt it to dynamic menu from
database so I can use some id or anything which will be unique for each
menu item.
I have just this because and don't know how next:
$('#accordian h3').click(function () {
$(this).addClass("active1")
});
Complete source is here http://jsfiddle.net/BERRF/. Answer in jsfiddle
would be best. Thanks advance.

No comments:

Post a Comment