It might be easier (and safer security wise) to build the element with jQuery like:

```loc.prepend($("<div />", { class: "alert alert-" + level }).append("<button />", { class: "close", ... ```

It might be a tad more verbose but jQuery should escaped everything so we don't open ourselves up to any obscure security bugs.