I know there are such questions, but the solutions don't work for me.
I want to append Bootstrap message like this
But I cannot insert times HTML entity (×) as entity.
$(function() {
var errors = {
"error1": "message1",
"error2": "message2"
}
$.each(errors, function(name, message) {
var $span = $('<span/>', {
text: "×"
});
var $button = $('<button/>', {
"class": "close"
});
var $alert = $('<div/>', {
"class": "alert alert-danger alert-dismissible",
text: message
});
$('#error-box').append($alert.append($button.append($span)));
});
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="error-box">
</div>