Using jquery and the Bootstrap Datepicker, how do I get the new date value I selected using the Bootstrap Datepicker? FYI, I\'m using Rails 3 and Coffescript.
I set
I was able to find the moment.js object for the selected date with the following:
$('#datepicker').data('DateTimePicker').date()
More info about moment.js and how to format the date using the moment.js object
For bootstrap datepicker you can use:
$("#inputWithDatePicer").data('datepicker').getFormattedDate('yyyy-mm-dd');
this works with me for inline datepicker
(and the other)
$('#startdate').data('datepicker').date
If you wan't the date in full text string format you can do it like this:
$('#your-datepicker').data().datepicker.viewDate
I tried with the above answers, but they didn't worked out for me; So as user3475960 referred, I used $('#startdate').html()
which gave me the html text so i used it as necessary...
May be some one will make use of it..
Generally speaking,
$('#startdate').data('date')
is best because
$('#startdate').val()
not work if you have a datepicker "inline"