简体   繁体   中英

Javascript problems with IE8

I'm trying to disable an input with JavaScript or 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.

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 :)

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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