The behavior is caused by a conflict in the code. When you click the close button, you create and delete the new .media-list-display .
_close.bind('click',function(e){
The problem is that the close button is also the <a> inside the .media-list , so when it is clicked, it fires both events, creating an endless loop of deletion and creation.
Mark the link with warnings about conflicting parts.
source share