我很难让 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/