0

我正在使用 jquery mobile 并使用 simpledialog2 来创建对话框。

我的代码

<li><a href="#" data-rel="dialog" onclick="return openpopup();" style="font-weight:normal;">Register</a></li>



function openpopup() {
    $('#mobile-login-panel').simpledialog2({
       autoOpen: false,
    resizable: true,
    height: 'auto',
    headerText: 'Sign in',
    headerClose: true,
    width:'auto',
    headerClose: true,
        blankContent:"SomeHtml"


    });
    $("div.ui-simpledialog-container ").appendTo($("form#frmdiaLogin"));
    return false;
    }

现在此对话框已正确打开。但是在关闭时会抛出错误

$.mobile.sdCurrentDialog.sdIntContent.find('select').each(function() {

有什么解决办法吗?

4

1 回答 1

0

我可以修复它的唯一方法是使用 SimpleDialog2.js 的未压缩版本并更改以下内容:

if ( self.options.mode === 'blank' ) {
        $.mobile.sdCurrentDialog.sdIntContent.find('select').each(function() {
            if ( $(this).data('nativeMenu') == false ) {
                $(this).data('selectmenu').menuPage.remove();
                $(this).data('selectmenu').screen.remove();
                $(this).data('selectmenu').listbox.remove();
            }
        });
    }

if ( self.options.mode === 'blank' ) {
        if ($.mobile.sdCurrentDialog) {
            $.mobile.sdCurrentDialog.sdIntContent.find('select').each(function() {
                if ( $(this).data('nativeMenu') == false ) {
                    if ( $(this).data('selectmenu') ) {
                        $(this).data('selectmenu').menuPage.remove();
                        $(this).data('selectmenu').screen.remove();
                        $(this).data('selectmenu').listbox.remove();
                    }
                }
            });
        }
    }
于 2014-10-08T20:00:43.783 回答