Why can't I add a <br /> with JQuery .html?
dom, html, jquery
Solution
Try breaking it up into a chain:
var $div = $('<div class="error"></div>').html('No more foo allowed')
.append('<br />');
$('div.error_container').html($div);
Problem
Why does this code work: ``` $('div.error_container').html('<div class="error">No more foo allowed</div>'); ``` But this code causes an error: ``` $('div.error_container').html('<div class="error">No more foo allowed<br /></div>'); ``` I've tried putting the `<br />` before and after the `</div>` tag, same error. I've tried changing it from `<br />` to `<br>`. Chrome always says the following in the inspector: ``` Uncaught SyntaxError: Unexpected token ILLEGAL ```