Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Twitter Bootstrap Message Box Plugin
(function ($) {
/* Twitter Bootstrap Message Helper
** Usage: Just select an element with `alert` class and then pass this object for options.
** Example: $("#messagebox").message({text: "Hello world!", type: "error"});
** Author: Afshin Mehrabani <>
** Date: Monday, 08 October 2012
$.fn.message = function(options) {
//remove all previous bootstrap alert box classes
this[0].className = this[0].className.replace(/alert-(success|error|warning|info)/g , '');
this.html(options.text).addClass("alert-" + (options.type || "warning"));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.