📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials jQuery in Practice Notification Toast

Notification Toast

4 min read
Toast notifications are brief pop-up messages. Append a styled div, slideDown to show it, then automatically remove it after a few seconds using setTimeout. Support different types like success and error.

Toast Notifications

function toast(msg, type = 'success') {
  const el = $('
') .addClass(type) .text(msg) .appendTo('body') .fadeIn(300); setTimeout(() => el.fadeOut(300, () => el.remove()), 3000); } toast('Saved!'); toast('Error occurred', 'error');