I’m using the jquery-ui datepicker in a Rails app. I have 2 forms for entering data. One is a regular Rails view page and the other is a Bootstrap modal. The modal one isn’t working.
This is the coffeescript (I’m assuming this will work for both):
$("#expense_exp_date").datepicker dateFormat: "yy-mm-dd"
This is the Rails view code and corresponding html:
<%= f.input :exp_date, :as => :string, :label => 'Date', :class => 'calendar hasDatepicker', :input_html => {:value => Date.today.to_s} %>
<input class="string required hasDatepicker" id="expense_exp_date" name="expense[exp_date]" size="50" type="text" value="2013-01-21">
This is the Bootstrap modal code and corresponding html:
<%= f.input :exp_date, :as => :string, :label => 'Date', :class => 'calendar hasDatepicker', :input_html => {:value => Date.today.to_s}, :input_html => {:style => 'width: 180px'} %>
<input class="string required" id="expense_exp_date" name="expense[exp_date]" size="50" style="width: 180px" type="text">
Why is “hasDatepicker” missing from the modal html?
Thanks!
Try to pass the
classoption inside theinput_htmlOption hash: