close

Closes the ContextMenu. This method can be prevented to stop the closure.

Example

<div id="target">Target</div>
<ul id="context-menu">
    <li id="Item1">Item 1
        <ul>
            <li>Sub Item 1</li>
            <li>Sub Item 2</li>
            <li>Sub Item 3</li>
        </ul>
    </li>
    <li>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");
    // close the ContextMenu
    contextMenu.close();
</script>

Parameters

element Element|jQuery

If called without arguments, will close the ContextMenu. If passed an item, it will be closed (if opened).

Returns

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

In this article