enable

Enables or disables an item of a ContextMenu. This can optionally be accomplished on initialization by setting the disabled="disabled" on the desired menu item html element.

Example

<div id="target">Target</div>
<ul id="context-menu">
    <li>Item 1
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
            <li>Sub Item 3</li>
        </ul>
    </li>
    <li id="secondItem">Item 2
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
            <li>Sub Item 3</li>
        </ul>
    </li>
</ul>
<script>
    // initialize the ContextMenu
    $("#context-menu").kendoContextMenu({
        target: "#target"
    });
    // get a reference to the ContextMenu widget
    var contextMenu = $("#context-menu").data("kendoContextMenu");
    // disable the li menu item with the id "secondItem"
    contextMenu.enable("#secondItem", false);
</script>

Parameters

element String|Element|jQuery

Target element

enable Boolean

Desired state

Returns

kendo.ui.ContextMenu Returns the ContextMenu object to support chaining.

In this article