toggle

Change the state of a togglable button.

This method does not trigger the toggle event!

Parameters

command String|Element|jQuery

A string, DOM element or jQuery object which represents the togglable button which state will be changed. A string is treated as jQuery selector.

state Boolean

A boolean flag that determines whether the button will be toggled or not.

Example - change the state of togglable buttons using the API

<div id="toolbar"></div>
<script>
    $("#toolbar").kendoToolBar({
      items: [
        { type: "buttonGroup", buttons: [
          { type: "button", togglable: true, id: "foo", text: "foo", group: "group1" },
          { type: "button", togglable: true, id: "bar", text: "bar", group: "group1" }
          ]
        }
      ]
    });

    var toolbar = $("#toolbar").data("kendoToolBar");
    toolbar.toggle("#foo", true); //select button with id: "foo"
    toolbar.toggle("#bar", true); //select button with id: "bar" (also deselects "#foo" as the buttons are from the same group
</script>
In this article