It's best to do something like this when creating a new HTML element...
// Close button
var $button = $('<button/>')
.attr('type', 'button')
.addClass('close')
.attr('data-dismiss', 'alert')
.attr('aria-label', 'Close'),
// The small 'x'
$cross = $('<span/>')
.attr('aria-hidden', 'true')
.html('×');
// Append the cross to the button element
$button.append($cross);
// Append the close button to the alert and add the class
// that it's dimissible
$alert.append($button)
.addClass('alert-dismissible');
It's best to do something like this when creating a new HTML element...
You can see that I have done this in my fork