您应该能够通过jQuery中的attr()
或prop()
函数设置这些,如下所示:
jQuery (< 1.7):
// This will disable just the div
$("#dcacl").attr('disabled','disabled');
or个个
// This will disable everything contained in the div
$("#dcacl").children().attr("disabled","disabled");
jQuery (>= 1.7):
// This will disable just the div
$("#dcacl").prop('disabled',true);
or个个
// This will disable everything contained in the div
$("#dcacl").children().prop('disabled',true);
or个个
// disable ALL descendants of the DIV
$("#dcacl *").prop('disabled',true);
Javascript:
// This will disable just the div
document.getElementById("dcalc").disabled = true;
or个个
// This will disable all the children of the div
var nodes = document.getElementById("dcalc").getElementsByTagName('*');
for(var i = 0; i < nodes.length; i++){
nodes[i].disabled = true;
}