(function (window, document, $) { function remoteControl() { var self = this; self.showMenu = function (page, item) { $('#confirmFlyout').popup("close").remove(); var html = '
'; html += '
'; html += '

Remote Control

'; html += '
'; html += '
'; html += '
test'; html += '
'; html += '

'; html += '

'; html += '
'; html += '
'; $(document.body).append(html); $('#remoteControlFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () { $(this).off("popupafterclose").remove(); }); }; } window.RemoteControl = new remoteControl(); })(window, document, jQuery);