Busco a un método para habilitar e inhabilitar la div id = "Dcalc" y sus hijos.
<div id="dcalc" class="nerkheArz"
style="left: 50px; top: 150px; width: 380px; height: 370px;
background: #CDF; text-align: center" >
<div class="nerkh-Arz"></div>
<div id="calc"> </div>
</div>
Quiero deshabilitarlos al cargar la página y luego, con un clic, ¿puedo habilitarlos?
Esto es lo que he intentado
document.getElementById("dcalc").disabled = true;
Debería poder configurarlos mediante las funciones attr()
o prop()
en jQuery como se muestra a continuación:
jQuery (<1.7):
// This will disable just the div
$("#dcacl").attr('disabled','disabled');
o
// 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);
o
// This will disable everything contained in the div
$("#dcacl").children().prop('disabled',true);
o
// disable ALL descendants of the DIV
$("#dcacl *").prop('disabled',true);
Javascript:
// This will disable just the div
document.getElementById("dcalc").disabled = true;
o
// 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;
}
Este artículo se recopila de Internet, indique la fuente cuando se vuelva a imprimir.
En caso de infracción, por favor [email protected] Eliminar
Déjame decir algunas palabras