JavaScript/jQuery Chat - Custom Deleted Message

To change the "This message was deleted" text in deleted messages, create a messageTemplate. The following code snippet shows how to replace the default text with a "trash" icon:

index.js
  • $(() => {
  • const chat = $("#chat").dxChat({
  • messageTemplate: (data, $container) => {
  • if (data.message.isDeleted) {
  • return `<i class="dx-icon-trash"></i>`;
  • }
  • return data.message.text;
  • },
  • }).dxChat('instance');
  • });