I am using the mobile jQuery calendar from here: http://demos.jquerymobile.com/1.4.1/datepicker/
Looks simple, but I can't use the onSelect function to catch the selected date.
What I have is this:
<link rel="stylesheet" href="http://code.jquery.com/mobile/git/jquery.mobile-git.css" />
<link rel="stylesheet" href="/jquery-mobile-datepicker-wrapper-master/jquery.mobile.datepicker.css" />
<link rel="stylesheet" href="/jquery-mobile-datepicker-wrapper-master/jquery.mobile.datepicker.theme.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="/jquery-mobile-datepicker-wrapper-master/external/jquery-ui/datepicker.js"></script>
<script src="http://code.jquery.com/mobile/git/jquery.mobile-git.js"></script>
<script src="/jquery-mobile-datepicker-wrapper-master/jquery.mobile.datepicker.js"></script>
<script>
$( document ).ready(function() {
$('.date-input-inline').datepicker({
onSelect: function(dateText, inst) {
alert("Date is : " + dateText);
}
});
});
</script>
Then HTML:
<body>
<input type="text" class="date-input-inline" data-inline="true" data-role="date">
This gives me on my webpage an input field and a calendar, as you would expect.
The problem is, when I click on a date, I get no alert showing the selected date.
How can I get the selected date from this calendar, and how is this working without initialization?
The files in the script src are the exact ones taken from https://github.com/arschmitz/jquery-mobile-datepicker-wrapper
It says here - https://github.com/arschmitz/jquery-mobile-datepicker-wrapper, that it auto-initializes on data-role="date". Also that date should be used, not datepicker. I have tried that, but it makes no difference.