charan
charan

Reputation: 292

how to apply styles for selected item in the kendo menu

I am using Kendo Menu, I am trying to apply styles for selected item in the menu. I have tried like

.k-menu .k-state-selected> .k-link {
    color: lightcoral;
}

It is not worked out in my case. can any one help me to fix this

Upvotes: 1

Views: 5775

Answers (1)

OnaBai
OnaBai

Reputation: 40887

There is not such concept of selected option. You have a select event but it does not stay selected. So, you should do it by yourself.

$("#menu").kendoMenu({
    select: function (e) {
        // Remove previously selected options for this menu
        $(".k-state-selected", this.element).removeClass("k-state-selected");
        // Select item
        $(e.item).addClass("k-state-selected")
    }
});

With this, you can use the style as you defined:

.k-menu .k-state-selected> .k-link {
    color: lightcoral;
}

Example in here http://jsfiddle.net/OnaBai/7bk2h/1/

Upvotes: 2

Related Questions