-1
でコンボボックスを作成し、私をheplください私はID]タブおよび配列値とのコンボボックスを作成したいが、私のコードは動作しませんID]タブおよび配列値
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
function createCombobox(tabId, arr) {
var select = document.getElementById("tabId");
for(var i = 0; i < arr.length; i++) {
var opt = arr[i];
var el = document.createElement("option");
el.textContent = opt;
el.value = opt;
select.appendChild(el);
}
}
</script>
<select id="checkWeek">
<option>Choose a week</option>
</select>
<script>
$(document).ready(function(){
var arr = [1, 2, 3, 4, 5, 6];
createCombobox(checkWeek,arr);
});
</script>
ありがとうございました。あなたはあなたのコード内の2つの問題の下に修正する必要があり
へ、 本当に? :-( –