clearMessages
Clears all messages from the view without affecting the data source.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This message will be cleared when you click the button below.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "All messages will disappear from the view!",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
}
];
let chat = $("#chat").kendoChat({
authorId: "user1",
dataSource: messagesData
}).data("kendoChat");
// Clear messages after 3 seconds
setTimeout(function() {
chat.clearMessages();
}, 3000);
</script>
In this article