toolClick

Fires when a button from the toolbar is clicked.

Event Data

e.sender kendo.ui.Chat

The widget instance which fired the event.

e.name String

The name of the button clicked.

e.button Element

The DOM element of the clicked button.

e.messageBox Element

The input element of the message box.

Example

<div id="chat"></div>
<script>
$("#chat").kendoChat({
    toolClick: function(ev){
    switch (ev.name) {
        case "Hello":
            ev.sender.postMessage("Hello (sent from button)");
            break;
        case "Smile":
            var input = $(ev.messageBox);
            input.val(input.val() + " :)");
            break;
    }
    },
    toolbar: {
        buttons: [
            { name: "Hello", text: "Hello" },
            { name: "Smile", text: "Smile" }
        ]
    }
});
</script>
In this article