Initialization
Options
Events
Methods
The methods .open() can be used to manual trigger events to open the overlay with the search container like the following:
.open()
<div class="container"> <div class="d-flex justify-content-start align-items-center m-4"> <button type="button" class="btn btn-outline-primary me-2" id="select-overlay-open">open</button> </div> <select multiple="multiple" id="select-overlay"> <option value="Banana">Banana</option> <option value="Apple">Apple</option> <option value="Orange">Orange</option> <option value="Lemon" selected="selected">Lemon</option> <option value="Pepper">Pepper</option> <option value="Mushrooms">Mushrooms</option> <option value="Cabbages">Cabbages</option> <option value="Celery">Celery</option> <option value="Garlic">Garlic</option> <option value="Brocoli">Brocoli</option> </select> </div>
let select = new betterNiceSelect.BetterNiceSelect("#select-overlay"); document.querySelector("#select-overlay-open").addEventListener("click", function () { select.open("A"); });