DatePicker on date-selected not working
Hi
I'm trying to capture the event when the date gets changed and I'm not sure how to do it. With the old .95a version I could use the date-selected event but I can't seem to get it to work with version 2.0.27. Here is my html and script.
<div>
<div id="dtpStartsOn" class="input-control text span3" data-role="datepicker" data-date="2014-01-01" data-effect="slide" data-format="yyyy-mm-dd" >
<input id="txtDate" type="text" />
<button class="btn-date" type="button"></button>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#dtpStartsOn').on('date-selected', function (el, dateString, dateMoment) {
alert('date-selected');
});
});
</script>
For the moment there is no date-selected trigger anymore
is there any other possibility, to read this date ?
Yes, I think so. Try it like that:
$("#datepicker").datepicker({selected: function(dateString, dateObject) {
alert('date-selected');
}});
yes it works.. but, we can change this date on lifetime ? e.g. $('#datepicker').setDate("2014-02-02" );
Have you solved the problem?
Would you be able to change the date?
Thanks and regards
i tried it like you said it but it didnt work. I am trying to do exactly as what is done in the event binding example of metro UI. But no matter what i try it doesn't work i have tried this:
<div class="input-control text" data-role="datepicker" data-on-select="alert(d +'\n'+ d0)">
<input type="text">
<button class="button"><span class="mif-calendar"></span></button>
</div>
it dint work and i have tried this too:
$("#datepicker").datepicker({selected: function(dateString, dateObject) {
alert('date-selected');
}});
my code is:
$(function() {
// Setzte aktuelles Datum
$("#AktuellesStartDatum").datepicker({selected: function(dateString, dateObject) {
console.log('AktuellesStartDatum date-selected');
}});
$('#AktuellesStartDatum').on('date-selected', function (el, dateString, dateMoment) {
alert('date-selected');
});
$("#AktuellesStartDatum").datepicker('destroy');
$("#AktuellesStartDatum").datepicker({ date : new Date() });
$("#AktuellesEndDatum").datepicker('destroy');
$("#AktuellesEndDatum").datepicker({ date : new Date() });
//console.log(getFiles('path/to/dir'));
//console.log(checkForAvailblePrnFiles("../log/"));
console.log('TEST LOG 1');
DWH_Click_Write('#$anzdaten(0)');
readCSV();
});