j查询错误"Uncaught TypeError: Cannot read property 'apply' of undefined"



我正在基于选择字段的更改中的jQuery对话框中的确定按钮。

该部分有效,但是当我单击确定或"关闭"以保存该信息并继续执行以下错误时,出现以下错误。

铬:未定义

Firefox:TypeError:D.Click是不确定的

... e =" button">')。单击(function(){d.Click.Apply(C. element [0],grigonments)})....
jQuery-ui.min.js(第14行,Col 5350)

    var disposition;  // I'm using this so that the alert('fixed') doesn't get call on load...  
//  Callback Disposition Dialog
$('#disposition_modal').dialog({
    open: function () {  // removed the default close link
        $(this).parent().children(':first').children('a').remove();
    },
    buttons: [{
        text: 'Cancel',
        Ok: function () {
            $(this).dialog("close");
        }
    }, {
        text: 'OK',
        disabled: true,
        id: 'dm_btn',
        Ok: function () {
            if (disposition !== '' && undefined !== disposition) {
                alert('fixed');
                $(this).dialog("close");
            }
        }
    }]
});
// toggle the OK button 
$('#disposition_id_in2').change(function () {
    disposition = $('#disposition_id_in2').val();
    if ($('#disposition_id_in2').val()) {
        $('#dm_btn').attr('disabled', false);
    } else {
        $('#dm_btn').attr('disabled', true);
    }
});

这是问题最小值的JSFIDDLE蒸馏:JSFIDDLE按钮错误

您需要更改"确定",以"单击"按钮。

buttons: [{
    text: 'Cancel',
    click: function () {
        $(this).dialog("close");
    }
}, {
    text: 'OK',
    disabled: true,
    id: 'dm_btn',
    click: function () {
        console.log(disposition);
        if (disposition !== '' && undefined !== disposition) {
            alert('fixed');
            $(this).dialog("close");
        }
    }
}]

jsfiddle

相关内容

最新更新