bootstrapmaterialdatepicker get selected value on changes
To get the selected value from a Bootstrap Material DatePicker when it changes, you can use the changeDate
event provided by the library. Here's an example of how you can achieve this:
$('#datepicker').on('changeDate', function(e) {
var selectedDate = e.date;
console.log(selectedDate);
});
In this example, we're using the changeDate
event handler to listen for changes in the date picker. When a date is selected or changed, the changeDate
event is triggered, and the provided callback function is executed. Inside the callback function, we can access the selected date using the e.date
property.
In the example, we're simply logging the selected date to the console. You can modify this code to perform any desired action with the selected value.
Make sure to replace #datepicker
with the actual ID or selector of your date picker element.
That's it! With this code, you will be able to retrieve the selected value from the Bootstrap Material DatePicker when it changes.