fix adding to select

This commit is contained in:
Your Name
2024-06-11 21:55:16 +03:00
parent 40bb5d83f0
commit 78cc72fafa
3 changed files with 30 additions and 23 deletions

View File

@@ -22,38 +22,44 @@ $(document).ready(function () {
} else { } else {
secretars.push(element.fio) secretars.push(element.fio)
} }
if (element.predsed == 1) { if (element.predsed == 1) {
preds.push(element.fio) preds.push(element.fio)
} }
}); });
console.log(preds)
console.log(secretars)
console.log(alluchs)
for (i = 0; i < preds.length; i++) { preds.forEach( function (item) {
let newOption = new Option(preds[i], preds[i]) let newOption = new Option(item, item)
predsel.appendChild(newOption) predsel.appendChild(newOption)
} })
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch1.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch2.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch3.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch4.appendChild(newOption);
})
secretars.forEach(function (item) { secretars.forEach(function (item) {
let newOption = new Option(item, item) let newOption = new Option(item, item)
secretar.appendChild(newOption) secretar.appendChild(newOption)
}) })
alltagych = Array.from( $('select[id^="uchgak"]'))
alltagych.forEach(function (alltagychItem) {
alluchs.forEach(function (item) {
const option = document.createElement('option');
option.value = item;
option.textContent = item;
alltagychItem.appendChild(option)
})
})
}); });
}); });

View File

@@ -27,6 +27,7 @@ btnadd.onclick = function (){
} }
) )
document.getElementById("fio").value = ""; document.getElementById("fio").value = "";
document.getElementById("predsedatel").checked = false; document.getElementById("predsedatel").checked = false;
document.getElementById("recentzent").checked = false; document.getElementById("recentzent").checked = false;

View File

@@ -19,14 +19,14 @@
</div> </div>
<div class="row"> <div class="row">
<label>Участник</label> <label>Участник1</label>
<select id="uchgak1"> <select id="uchgak1">
<option>--Выбери--</option> <option>--Выбери--</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
<label>Участник</label> <label>Участник2</label>
<select id="uchgak2"> <select id="uchgak2">
<option>--Выбери--</option> <option>--Выбери--</option>
</select> </select>
@@ -34,14 +34,14 @@
<div class="row"> <div class="row">
<label>Участник</label> <label>Участник3</label>
<select id="uchgak3"> <select id="uchgak3">
<option>--Выбери--</option> <option>--Выбери--</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
<label>Участник</label> <label>Участник4</label>
<select id="uchgak4"> <select id="uchgak4">
<option>--Выбери--</option> <option>--Выбери--</option>
</select> </select>