You should be able to set these via the attr()
or prop()
functions in jQuery as shown below:(您应该能够通过jQuery中的attr()
或prop()
函数设置它们,如下所示:)
jQuery (< 1.7):(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):(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:(使用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;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…