Bootstrap DatePicker - Onchange

I am using the Bootstrap 3 Datepicker plugin. When a user selects a date, I want to update various parts of my user interface. I am basically trying to create a function called when the date changes. However, I was not successful in my attempts. I am currently trying to do the following

$('#myDatePicker').datetimepicker({ change: function() { alert('date has changed!'); } }); 

Unfortunately, the change function never works. How do I call a function when the date changes in the date pick list?

+5
source share
3 answers

According to the docs , the dp.change event:

 $('#myDatePicker').datetimepicker().on('dp.change',function(e){ console.log(e) }) 

http://www.codeply.com/go/5cBJkEHiAt

+5
source

You can try the following:

 $("#myDatePicker").datetimepicker().on('changeDate', function(e) { alert('date has changed!'); }); 

Link to boot document: changeDate

+4
source
 OnChange : Function(data) { valueAccessor()(data); } 
-1
source

Source: https://habr.com/ru/post/1265958/


All Articles