Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
$.fn.popupAlert = function(options) { const settings = $.extend({ message: "Hello!", delay: 2000, color: "green" }, options); return this.each(function() { const el = $(this); el.text(settings.message).css("color", settings.color).show(); setTimeout(() => el.hide(), settings.delay); }); }; // Override specific options $(".notice").popupAlert({ message: "Saved!", delay: 3000 });
Result
Open