Philip can you help me with this:
I have an option form and for every option i want to create multi inputs (checkbox).
I used your code, it works, but i can only add 1 input. How can i add more inputs for the selected option?
Thank you!
This is what i did
<select id = "lucrari" onchange = "makeBox()">
<optgroup label="Bucatarie">
<option value="masinaspalatvase" > Masina de spalat vase
</option>
<option value="plita">Plita</option>
</optgroup>
<optgroup label="Spatii publice">
<option value="grupsanitar">Grup Sanitar</option>
<option value="Sala mese">Sala mese</option>
</optgroup>
</select>
<br><br>
<div id = "inputBox"></div>
<script type = "text/javascript">
function makeBox() {
var a = "<input type = 'checkbox' name = 'box1' id = 'box1'>A fost reglata concentratia de detergent"
if (document.getElementById("lucrari").value=="masinaspalatvase" ) {
document.getElementById("inputBox").innerHTML = a;
}
else {
document.getElementById("inputBox").innerHTML = "";
}
}
</script>
Quote:
Originally Posted by Philip M
Surely you could have worked out how to deal with that?
Code:
<script type = "text/javascript">
function makeBox() {
var a = "<input type = 'text' name = 'box1' id = 'box1'>"
if (document.getElementById("fruits").value==1) {
document.getElementById("inputBox").innerHTML = a;
}
else {
document.getElementById("inputBox").innerHTML = "";
}
}
</script>
|