I attempt to disable my specific bootstrap select option using javascript.
I know how to disable "normal select option", but when using bootstrap select it just didnt works (its disabled/greyed but i can still choose it) here jsfidle
<select name="dropdownBranch" id="dropdownBranch" class="selectpicker" data-live-search="true">
<option value="0">Choose Number</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select id="pureDropDown">
<option value="0">Choose Number</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<button onclick="disableDropdown()">disable</button>
function disableDropdown(){
var selectobject;
selectobject=document.getElementById("dropdownBranch").getElementsByTagName("option");
selectobject[3].disabled=true;
selectobject=document.getElementById("pureDropDown").getElementsByTagName("option");
for(z=0;z<selectobject.length;z++){
selectobject[z].disabled=true;
}
}
i try to remove specific option too and the same case happen (work on normal dropdown but not work on bootstrap select)