Event hooks
The select ships with different event hooks for deep customization. Events are triggered through the lifecycle of the component where you can tie in custom functionality and code.
While users interact with the UI events like onChange, onSet, onInit ... will be triggered.
For a complete list of events go to the documentation See available lifecycle events →
Demo
onCancel: function (event, inst) { /* Logic for cancel button click */ },
onChange: function (event, inst) { /* Logic for value change */ },
onClose: function (event, inst) { /* Your custom event handler goes here */ },
onDestroy: function (event, inst) { /* Your custom event handler goes here */ },
onFilter: function (event, inst) { /* Your custom filtering goes here */ },
onInit: function (event, inst) { /* Logic running on component init */ },
onOpen: function (event, inst) { /* Your custom event handler goes here */ },
onTempChange: function (event, inst) { /* Logic for temporary value change */ }
Event log
JSHTML
mobiscroll.setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
$(function () {
$('#demo')
.mobiscroll()
.select({
inputElement: document.getElementById('demo-input'),
filter: true,
onCancel: function () {
// Logic for cancel button click
},
onChange: function () {
// Logic for value change
},
onClose: function () {
// Your custom event handler goes here
},
onDestroy: function () {
// Your custom event handler goes here
},
onFilter: function () {
// Your custom event handler goes here
},
onInit: function () {
// Logic running on component init
},
onOpen: function () {
// Your custom event handler goes here
},
onTempChange: function () {
// Logic for temporary value change
},
});
});
<label>
Select
<input mbsc-input id="demo-input" placeholder="Please select..." data-dropdown="true" data-input-style="outline" data-label-style="stacked" />
</label>
<select id="demo">
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</select>