Lifecycle events
The date picker 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 */ },
onInit: function (event, inst) { /* Logic running on component init */ },
onOpen: function (event, inst) { /* Your custom event handler goes here */ },
onPageChange: function (event, inst) { /* Your custom event handler goes here */ },
onPageLoaded: function (event, inst) { /* Use it to inject custom markup & attach custom listeners */ },
onPageLoading: function (event, inst) { /* Use it to load data on demand */ },
onTempChange: function (event, inst) { /* Logic for temporary value change */ }
Event log
JSHTML
mobiscroll.setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
mobiscroll.datepicker('#demo', {
controls: ['date'],
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
},
onInit: function () {
// Logic running on component init
},
onOpen: function () {
// Your custom event handler goes here
},
onPageChange: function () {
// Your custom event handler goes here
},
onPageLoaded: function () {
// Use it to inject custom markup & attach custom listeners
},
onPageLoading: function () {
// Use it to load data on demand
},
onTempChange: function () {
// Logic for temporary value change
},
});
<label>
Date
<input id="demo" mbsc-input data-label-style="stacked" data-input-style="box" placeholder="Please select..." />
</label>