JSFiddle - React, Tailwind, and code Playground
by ldiego
HTML
<form name="frm" onsubmit="return false;">
<input type="text" name="p1[]" id="p1" size="3"/><br/><br/>
<input type="text" name="p1[]" id="p2" size="3"/><br/><br/>
<input type="text" name="p1[]" id="p3" size="3"/><br/><br/>
<input type="text" name="p1[]" id="p4" size="3"/><br/><br/>
<input type="text" name="p1[]" id="p5" size="3"/><br/><br/>
<input type="text" name="p1[]" id="p6" size="3"/><br/><br/>
Cambia <input type="checkbox" name="porcentaje" id="porcentaje" value="0"/><br/><br/>
</form>
JavaScript
window.onload = function(){
var cambia = document.getElementById("porcentaje");
if(window.attachEvent)
cambia.attachEvent("onclick",Cambia);
else
cambia.addEventListener("click",Cambia);
Cambia();
};
function Cambia(){
var c = this;
for (var i = 0; ele = document.getElementsByName("p1[]")[i]; i++){
ele.disabled = !c.checked;
console.log(i + " = " + ele.disabled);
}
}