I have the following
<form class="form-inline" role="form">
<div class="col-xs-3">
<div class="pic-container">
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check11' value="">ciao</span><br>
</label>
</div>
</div>
<div class="col-xs-3">
<div class="pic-container">
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
<label>
<span><input type="checkbox" name="discounting" onchange='handleChange(this);' id='check21' value="">hola</span><br>
</label>
</div>
</div>
</form>
Id like by clicking the first check box that all check boxes in the second div with an ID of "check21" to be chacked automatically.
<script>
function handleChange(cb) {
if(cb.checked == true) {
document.getElementById("check21").checked = true;
alert('eyaicecold');
} else {
alert('Message 2');
var x = document.getElementById("check21").disabled= false;
}
}
</script>
I have used the following script which works but only for the first one. I wan to use the ids since the name and the value will be used to send the sql request trough the form.