简体   繁体   English

IE8的Javascript问题

[英]Javascript problems with IE8

I'm trying to disable an input with JavaScript or jQuery 我正在尝试使用JavaScript或jQuery禁用输入

//document.getElementById("monto").disabled=true;
$(document).ready(function(){
    $("#monto").attr("disabled", "disabled");
});

The code works fine in chrome, Firefox, and some versions of IE, but doesn't work with IE 8, also tried with Hide/show but doesn't work too. 该代码在chrome,Firefox和某些版本的IE中都可以正常工作,但不适用于IE 8,也可以在“隐藏/显示”中尝试使用,但也无法正常工作。

I know the best solution is to upgrade, but my boss thinks our clients are too dumb to do that. 我知道最好的解决方案是升级,但是我的老板认为我们的客户太傻了,无法做到这一点。

try this article from stackoverflow :) 从stackoverflow尝试这篇文章 :)

var disableSelection = function(){
    $("#elementId").prop("disabled", true);    
};

var enableSelection = function(){
    $("#elementId").prop("disabled", false);
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM