JavaScript Joomla! 6 Joomla! 5 Joomla! 4 Template Basic

Display Dynamic System Alerts via JavaScript with Joomla.renderMessages()

Renders native accessible alerts (success, warning, error, info) inside #system-message-container without a page reload.

Updated on 24 November 2026 39 copies 134 views
media/com_example/js/notify.js
// Exibe notificação de sucesso no container padrão do template
Joomla.renderMessages({
  success: ['Configurações salvas com sucesso!'],
});

// Limpa mensagens anteriores e exibe erro dentro de um container específico
Joomla.removeMessages(document.querySelector('#meu-form-alerts'));
Joomla.renderMessages(
  { error: ['Não foi possível concluir a solicitação.'] },
  '#meu-form-alerts',
  false,
  6000
);
Pass a custom CSS container selector as the second argument to render inside a modal.

Technical explanation and best practices

After an AJAX save or client-side check, call Joomla.renderMessages() to reuse Joomla native accessible <joomla-alert> web component consistently.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.