How to get the selected date value while using Bootstrap Datepicker?

前端 未结 12 950
有刺的猬
有刺的猬 2020-11-28 10:37

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

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 10:51

    If you already have a number of dates already highlighted and want to determine which date was last clicked then you'll need the following:

    $('#startdate').data('datepicker').viewDate
    

    viewDate returns a JavaScript date object so you'll need to handle it accordingly.

提交回复
热议问题