click
Fires when the user clicks a command button.
The event does not fire for togglable buttons. If the button has
togglable: true
use thetoggle
event.
Event Data
e.target jQuery
The jQuery object that represents the command element.
e.id String
The id of the command element.
e.sender kendo.ui.ToolBar
The widget instance which fired the event.
Important Starting with R1 2023 the event arguments object no longer holds a reference to the ToolBar item (
e.item
). From that release on, the tools in the ToolBar are actual widget instances that can be taken using thekendo.widgetInstance()
method:var widget = kendo.widgetInstance(e.target);
. When the clicked tool is rendered in the OverflowMenu or in a popup of a SplitButton/DropDownButton it represents a menu item. Hence, it is not a Kendo widget. A reference to the jQuery element is still available in those cases in thee.target
event argument.
Example - subscribe to the "click" event during initialization
<div id="toolbar"></div>
<script>
$("#toolbar").kendoToolBar({
items: [
{ type: "button", id: "btn1", text: "Button 1" },
{ type: "button", id: "btn2", text: "Button 2" }
],
click: function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("click", e.target.text());
}
});
</script>
Example - subscribe to the "click" event after initialization
<div id="toolbar"></div>
<script>
$("#toolbar").kendoToolBar({
items: [
{ type: "button", id: "btn1", text: "Button 1" },
{ type: "button", id: "btn2", text: "Button 2" }
]
});
var toolbar = $("#toolbar").data("kendoToolBar");
toolbar.bind("click", function(e){
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log("click", e.target.text());
});
</script>