I am using kendo menu.For this I have parent level menu and for each I have sub items. I want to get the parent item text and sub item text in the select event.
To get the parent text,I used "open" function,by this I am able to get parent text,but I want this in select event.
$("#menu").kendoMenu({
open: function onOpen(e) {
parentText = $(e.item).children(".k-link").text();
},
});
If you only have parent and child (two levels menu) you can use as selector for the parent the CSS class k-state-active
This is a CSS class to add to each of the ancestors of the selected option.
Your code would be:
select: function (e) {
var me = e.item;
console.log("me", $(child).find(".k-link").text());
var father = $(".k-state-active", this.element);
console.log("father", father.text().trim());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.