Using jQuery methods like .remove() and .empty() clears all event
handlers from the removed elements. That's why the buttons no longer
work after you remove them (using .empty()) and show them again.
To avoid this, you can use the .detach() method instead, or hide the
elements rather than remove them. For example, instead of:
dialog.panelBottom.$element.empty().append(dialog.buttonSelect[item.data.group].$element);
You can write:
dialog.panelBottom.$element.children().detach();
dialog.panelBottom.$element.append(dialog.buttonSelect[item.data.group].$element);
--
Bartosz Dziewoński