Event Hooks
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
onActiveDateChange: function(event, inst) { /* Logic for active date change */ },
onCancel: function (event, inst) { /* Logic for cancel button click */ },
onCellClick: function (event, inst) { /* Logic for cell click */ },
onCellHoverIn: function (event, inst) { /* Logic for handling cell hover in */ },
onCellHoverOut: function (event, inst) { /* Logic for handling cell hover out */ },
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 */ },
onLabelClick: function (event, inst) { /* Logic for label click */ },
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: ' '
});
$(function () {
$('#demo')
.mobiscroll()
.datepicker({
controls: ['calendar'],
select: 'range',
onActiveDateChange: function () {
// Logic for the active date change
},
onCancel: function () {
// Logic for cancel button click
},
onCellClick: function () {
// Logic for event click
},
onCellHoverIn: function () {
// Logic for handling cell hover in
},
onCellHoverOut: function () {
// Logic for handling cell hover out
},
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
},
onLabelClick: function () {
// Logic for label click
},
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>
Range
<input id="demo" mbsc-input data-label-style="stacked" data-input-style="box" placeholder="Please select..." />
</label>