xxxxxxxxxx
1
<div class="col-3">
2
<select id="Drop1" class="mdb-select md-form colorful-select dropdown-dark mx-2" multiple>
3
<option value="" disabled selected>Car Features</option>
4
</select>
5
<label class="mdb-main-label">Car Features</label>
6
</div>
7
8
<div class="col-3">
9
<select id="Drop2" class="mdb-select md-form colorful-select dropdown-dark mx-2" multiple>
10
<option value="" disabled selected>Bike Features</option>
11
</select>
12
<label class="mdb-main-label">Bike Features</label>
13
</div>
1
1
2
xxxxxxxxxx
1
$("$drop1").ready(function() {
2
$(".mdb-select").materialSelect();
3
});
4
5
$("$drop2").ready(function() {
6
$(".mdb-select").materialSelect();
7
});
8
9
arr = ["Honda", "Suzuki", "Hyundai"];
10
var select = document.getElementById("Drop1");
11
for (var i = 0; i < arr.length; i++) {
12
var option = document.createElement("OPTION"),
13
txt = document.createTextNode(arr[i]);
14
option.appendChild(txt);
15
option.setAttribute("value", arr[i]);
16
select.insertBefore(option, select.lastChild);
17
}
18
19
var select1 = document.getElementById("Drop2");
20
for (var i = 0; i < arr.length; i++) {
21
var options = document.createElement("OPTION"),
22
txt = document.createTextNode(arr[i]);
23
options.appendChild(txt);
24
options.setAttribute("value", arr[i]);
25
select1.insertBefore(options, select1.lastChild);
26
}
Console errors: 0