What you want to achieve is not clear but…
You can't place checkboxes as option
s inside a select
element.
However, you can fake it doing that kind of things:
var expanded = false;
var checkboxes = document.getElementById("checkboxes");
function toggleCBs() {
expanded = !expanded;
if (expanded) {
checkboxes.style.display = "block";
} else {
checkboxes.style.display = "none";
}
}
.multiselect {
width: 160px;
}
.selectBox {
position: relative;
}
.selectBox select {
width: 100%;
font-weight: bold;
}
.overSelect {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
#checkboxes {
display: none;
border: 1px #dadada solid;
}
#checkboxes label {
display: block;
}
#checkboxes label:hover {
background-color: #1e90ff;
}
<form>
<div class="multiselect">
<div class="selectBox" onclick="toggleCBs()">
<select class="form-control">
<option value="0">---- Please Select ----</option>
</select>
<div class="overSelect"></div>
</div>
<div id="checkboxes">
<label>
<input type="checkbox"/>HTML</label>
<label>
<input type="checkbox"/>CSS</label>
<label>
<input type="checkbox"/>JS</label>
</div>
</div>
</form>
Highly inspired from: How to use Checkbox inside Select Option
I hope it helps.