Pretty sure you can do `$("#chat-messages").empty().append(elements)` since elements is a jQuery object now.