I have two level dropdown list: Home Categories Contact, etc.
Under the "Categories" there are sub categories.
I want to apply selected class to "Categories" whenever the user selects something from sub categories.
For example when user clicks "home" home is given class of selected but when user selects anything from subcategories under the "Categories" it should be given class of "selected". At present my jquery code is:
$(function() {
$('a').click(function() {
$('a').removeClass('selected');
$(this).addClass('selected');
});
});
Which is adding selected class to dropdown items also.
Please help me out