javascript - 代码未在 IE 中与 Jquery 同步运行

标签 javascript internet-explorer jquery

我很难让 IE 同步运行 jscript 代码。其他浏览器没有问题。下面是代码示例:

function renew_order() {
    $.ajaxSetup({async:false});
    // These 3 lines are to disable 2 buttons and show a progress indicator.  This never happens,  
    // which is the main problem.
    $('#cancel_order_button').attr("disabled", "disabled");
    $('#renew_order_button').attr("disabled", "disabled");
    $('#renew_order_load').show();

    // Make some Ajax call to do some processing
    $.getJSON(url, function(json) {
    $.each (json, function (type, name) {
        new_order_id = json.OrderId;
        });
    });

    // Close the modal box this is diaplyed on and display some results on the web page
$.modal.close();
display_new_order(order_list);
}

基本上就是代码运行,模态框关闭,结果显示。但是在进程运行时,模式框上的按钮永远不会显示为禁用状态。这似乎只是 IE 的问题。

最佳答案

尝试改用 prop 函数。

$(".example").prop("disabled", true);

如果还是不行

document.getElementById("example").disabled = true

关于javascript - 代码未在 IE 中与 Jquery 同步运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15532055/

相关文章:

javascript - 执行 javascript 代码以接受条款并打开下一页

html - <!--[if IE]> 无法在任何浏览器中运行

javascript - 编辑选项仅对在 php 中上传的用户可见

循环 : "Uncaught TypeError: Cannot read property ' value' of undefined"中的 Javascript 引用

javascript - react : TypeError: Cannot read property 'setState' of undefined

java - 这是一个已知的 IE 错误吗?未将提交参数传递给请求

javascript - IE9 中的新 XMLHttpRequest 导致 JScript 运行时错误 : Object doesn't support this property or method

javascript - 动态交换 "ul li"

javascript - 返回按钮从 javascript 模板加载相关的 html

javascript - 如何将html表格数据存入数组?