I have developing a simple wizard form in which the content is divided into four section. I have written CSS to show target section.
section {
display: none;
}
section:target {
display: block;
}
while i click next button i am trying to setAttribute disabled true for hidden section elements and try to remove disabled attribute from target section input elements from JavaScript.
var divElem = document.querySelector(".section-1");
var inputElements = divElem.querySelectorAll("input, select, textarea");
for (var i = 0; i < inputElements.length; i++) {
inputElements[i].setAttribute("disabled","true");
}
document.querySelector("#form-wizard").action = "#wizard-p-1";
var divElem2 = document.querySelector(".section-2");
var inputElements2 = divElem2.querySelectorAll("input, select, textarea");
for (var j = 0; j < inputElements2.length; j++) {
inputElements2[j].removeAttribute("disabled");
}
There is no error but it didn't set or remove any attribute.
Please help me to resolve this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…