I'm trying to append text and a nested div to the end of a list-group, I wand to get HTML output like this:
<div class="list-group-item">
<div class="small>
Username
<div class="pull-right">
<a class="btn btn-link btn-xs" href="url">edit</a>
</div>
</div>
</div>
Most of my jQuery code is based on the accepted solution from this post and this is what I've currently got:
$('<div>').attr('class', 'list-group-item').html(
$('<div>').attr('class', 'small').text('Username').html(
$('<div>').attr('class', 'pull-right').html($('<a>').attr({
'class': 'btn btn-link btn-xs',
'href': 'url'
}).text('edit')))).appendTo(this.find('.list-group'));
Everything appends except for the Username text, yet if I strip everything out after the username and run this code:
$('<div>').attr('class', 'list-group-item').html(
$('<div>').attr('class', 'small').text('Username'))
.appendTo(this.find('.list-group'));
The Username text is successfully appended. What am I missing to get them all to append? Thanks.