I am using the Mobiscroll Jquery demo and is trying to get the value of the aria-label to display in console.log. Currently I am getting null everytime I click on a date. Can anyone help me with this one please?
HTML
<div mbsc-page class="demo-date-picker">
<div style="height:100%">
<div id="demo"></div>
</div>
</div>
JQuery
<script>
mobiscroll.setOptions({
locale: mobiscroll.localeEn, // Specify language like: locale: mobiscroll.localePl or omit setting to use default
theme: 'ios', // Specify theme like: theme: 'ios' or omit setting to use default
themeVariant: 'light' // More info about themeVariant: https://docs.mobiscroll.com/5-20-0/calendar#opt-themeVariant
});
$(function () {
// Mobiscroll Calendar initialization
$('#demo').mobiscroll().datepicker({
controls: ['calendar'], // More info about controls: https://docs.mobiscroll.com/5-20-0/calendar#opt-controls
display: 'inline' // Specify display mode like: display: 'bottom' or omit setting to use default
});
});
var inputs = document.querySelectorAll("[aria-label]");
console.log(inputs.length);
for(var i = 0; i < inputs.length; i++){
inputs[i].addEventListener("click", function(e){
console.log(this.getAttribute("aria-label"));
});
}
</script>