I'm trying to use a datepicker plugin for Twitter Bootstrap found herehttps://github.com/eternicode/bootstrap-datepicker, which offers several ways to include a datepicker in an appl
When I put the following (demo code from the plugin) in my Rails app
<input type="text" value="02-16-2012" id="datepicker">and then call the datepicker method on the id
jQuery ->
$('#datepicker').datepicker
dateFormat: 'yy-mm-dd'the calendar drops down and works as expected. However, when I try to use it in simple_form like this
<%= f.input :when, as: :text, :input_html => { :rows => 1, :id => "datepicker", :value => "02-16-2012" } %>The calendar drops down when I focus on the field, but if if I move over different dates in the calendar, the dates in the form field are not changing accordingly.
This is the markup generated by simple_form
<div class="input text optional event_when"><label class="text optional" for="datepicker">When</label><textarea class="text optional" id="datepicker" name="event[when]" rows="1">02-16-2012</textarea></div>Can you explain why this might be happening?
According to the accepted answer at this question Datepicker with Twitter boostrap shows up but doesn't change date, you have to select the text box rather than a div as a datepicker like this
$('#datepicker>input').datepicker();However when I tried that the problem didn't go away.